From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 11ED03856964 for ; Fri, 16 Sep 2022 09:54:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 11ED03856964 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1663322096; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pGvpYK/C8sUtqfUOdBLEhU/ByU+GDdaXTxO0qn29Vr4=; b=U+sz3vKlAmPaagfYb5KeeB5I2m1oo1DnCuT+C0i2+AFg5bizvSqEoEHeFYlNgXT4OYQd+9 CoHskvi5qzwwyXUbX0E1lengydO13/xUYtL7jf8b2ZwLAaMTX3WA1ynB5uKsGG2CfhJl6N Tms9n7B5/0sxOA8iK1Uz3Eau1yUo15k= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-633-wrIfKXRzMfCtOYjDpPTnXQ-1; Fri, 16 Sep 2022 05:54:55 -0400 X-MC-Unique: wrIfKXRzMfCtOYjDpPTnXQ-1 Received: by mail-ej1-f69.google.com with SMTP id du20-20020a17090772d400b0077df99c5ab3so6520723ejc.3 for ; Fri, 16 Sep 2022 02:54:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=pGvpYK/C8sUtqfUOdBLEhU/ByU+GDdaXTxO0qn29Vr4=; b=D4XVwH4xWr/p2Cqws3dSlpifKsapGrLrDVJwtN8liWMmk4mWwhYyj0E79xtFnBuHwT CSz2+CKxvTFfsk724OhzP3Uup8Wx8m5a3gx/H4GlslFvakhJHgeGVHLCjWjMgT07r1yt +aR5SZYELK965Y9C7ttbpH5tkUoigk0L5FOUwZ70DAPOmZ1p7SPp2Tl7DJBcEH3ScDHp hZ9Sp9MpwypJROgEyPVASqdNQtTiTbpc1u0xFKmax84uw2nXFDXxu3xfwPVAuH533ZmS DDHGJR9cZET4YmhThTc8Z6wuAIAOm0XYF66Q/57iuZvJdmyozj4+0b4G/e/sXZ7hVW5B 95Hg== X-Gm-Message-State: ACrzQf0jMIpN31sySxWNmUZJxSCAAnLsr7qnsmW/xo5X5/cfsYq5YHfb rrri0du326PlULZlR1sf730zALawWTtO5fWswFo133K9jFfzdG1yJai6OV78iOYvu2OhT//0E+R DvE7CP+UDAghyOBefnVd5 X-Received: by 2002:a05:6402:2711:b0:451:327a:365f with SMTP id y17-20020a056402271100b00451327a365fmr3207911edd.315.1663322094131; Fri, 16 Sep 2022 02:54:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7fA0a7YRLFxhBXnSbSdkSFr2EfWvWzPqydGeWxMHflvNAWZI2j6VV/ayZg1wCCcKoW5uyetg== X-Received: by 2002:a05:6402:2711:b0:451:327a:365f with SMTP id y17-20020a056402271100b00451327a365fmr3207897edd.315.1663322093961; Fri, 16 Sep 2022 02:54:53 -0700 (PDT) Received: from fedora (vpn-konference.ms.mff.cuni.cz. [195.113.20.101]) by smtp.gmail.com with ESMTPSA id n21-20020aa7d055000000b0044629b54b00sm7570970edo.46.2022.09.16.02.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 02:54:53 -0700 (PDT) Date: Fri, 16 Sep 2022 05:54:51 -0400 From: Carlos O'Donell To: Szabolcs Nagy Cc: libc-alpha@sourceware.org Subject: Re: [PATCH v2 14/14] RFC elf: Fix slow tls access after dlopen [BZ #19924] Message-ID: References: MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Tue, Apr 13, 2021 at 09:21:58AM +0100, Szabolcs Nagy via Libc-alpha wrote: > In short: __tls_get_addr checks the global generation counter, > _dl_update_slotinfo updates up to the generation of the accessed > module. If the global generation is newer than geneneration of the > module then __tls_get_addr keeps hitting the slow path that updates > the dtv. > > Possible approaches i can see: > > 1. update to global generation instead of module, > 2. check the module generation in the fast path. > > This patch is 1.: it needs additional sync (load acquire) so the > slotinfo list is up to date with the observed global generation. > > Approach 2. would require walking the slotinfo list at all times. > I don't know how to make that fast with many modules. > > Note: in the x86_64 version of dl-tls.c the generation is only loaded > once, since relaxed mo is not faster than acquire mo load. > > I have not benchmarked this yet. Szabolcs, Could you please repost this as a distinct patch? I'd like to track this as a possible solution that we can discuss and improve. It's the only patch that we haven't applied from this series. Cheers, Carlos.