Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1172347imm; Wed, 19 Sep 2018 13:25:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbWywGusj+d8nrWxbWakJUANQm2QV6X6nwxmakxLhiVoRuYv5lnop+l46GiaLYcMvUCipC0 X-Received: by 2002:a17:902:b81:: with SMTP id 1-v6mr36321350plr.319.1537388747321; Wed, 19 Sep 2018 13:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537388747; cv=none; d=google.com; s=arc-20160816; b=1LxDVmpUg50TEr1OouGu6fBCL7dR2qt4dZv89jAcB04sXsUb0WwfWSAHuWG0UZQ4hL Nyb88eAPYz/uUN1FLO5/1TWCItu4DSqhOTO0rIvqLasmxEdasgxV/PDyXFrjq2SZtBHS lTUSox2vWKZMT1nVYBrcpainCCcwlYs8gqlORx5PjXrmQGQewqO9FmP9ubA6pJiXFnoN lpVZBp26ZtXbjnn7f5zPJAQmON+nz1u9eqTAXb+0CkK750mPbcJXLotndwf07zwe8/bc xoJOhf4jaJb3uUxHHKNd1MrXqDq1/SZSmu+i4oxvMa7jzuGnPBYJxGzjVfpY5l9cfXPW JcNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=wJezRLpvAQ8GjIAwhix5UZkF+lLcjAAdYEmpM9gNrLY=; b=NTyC1FnoSxZZ8XLSBYbHS7GFi9nM9fSq02uFN6X1ToW1E2HF+fo4QyZBBzzcDA+H49 RA1ZMs9LyfLs0W6xwsA6QRkZ4HeKmucsfaIumRT9LRlvhKR2E7WZZgUUtzQTGLoF5YSk /Ee3C40SUwnGt4dwWDRLN+eGZnYSocXU8hoO4qBsRM+Fd3cb1Aqg2EBqoDlqwX2sZJvG 7Q5EXLG6VFJ9gs+qlraRDzfVKnkgZKyPT/QgDffHmfxwv5wfyZJssy96ytKsOmAJzlRi M0mP9kVA/9YRKf8WY9vY3byw/7yMsxXVfzHcRa1wx4VPyuPN6FauQl5abmaCvmmw5F1K 7LTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=gBCsQQB3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5-v6si21582453plz.175.2018.09.19.13.25.01; Wed, 19 Sep 2018 13:25:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=gBCsQQB3; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732111AbeITBua (ORCPT + 99 others); Wed, 19 Sep 2018 21:50:30 -0400 Received: from mail.efficios.com ([167.114.142.138]:35962 "EHLO mail.efficios.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731271AbeITBu3 (ORCPT ); Wed, 19 Sep 2018 21:50:29 -0400 Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 01C3523EC63; Wed, 19 Sep 2018 16:10:56 -0400 (EDT) Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10032) with ESMTP id 8Wzw04EIz5MX; Wed, 19 Sep 2018 16:10:55 -0400 (EDT) Received: from localhost (ip6-localhost [IPv6:::1]) by mail.efficios.com (Postfix) with ESMTP id 2AA5923EC60; Wed, 19 Sep 2018 16:10:55 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 2AA5923EC60 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1537387855; bh=wJezRLpvAQ8GjIAwhix5UZkF+lLcjAAdYEmpM9gNrLY=; h=Date:From:To:Message-ID:MIME-Version; b=gBCsQQB33K/dxz9IwVM8LyTRA0TabQs5ceU41Cs2DGncWwX9xcBz5b96iQSqYEjiA XDNUufPe34rB21gbA43MDuXfiA3y3gBDYGyVgfQLcU1aJ70JDD14vZwIKenXDvukov sUFhEL9U+Y3IoEyrI0/CIqfQJwgCZGUOcvGQS0h1PbZ7ni2nmS0sbjqMzIw0T/bg1z rR2wW2BcnU0qEGVeMACY5hRTGezGECbgG1oIotJmw/eHPLPmytUBmAPTkofoH7Aj4p PQaggsGwlr66thnpQlVF5n0fl8ucDrEXgvdRCAT27wGtqNn6B/w7f4jOnvW28Q1E2X 5Oywr29QDj24g== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([IPv6:::1]) by localhost (mail02.efficios.com [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id PdbR3cA4F3NV; Wed, 19 Sep 2018 16:10:55 -0400 (EDT) Received: from mail02.efficios.com (mail02.efficios.com [167.114.142.138]) by mail.efficios.com (Postfix) with ESMTP id 0FEDD23EC56; Wed, 19 Sep 2018 16:10:55 -0400 (EDT) Date: Wed, 19 Sep 2018 16:10:54 -0400 (EDT) From: Mathieu Desnoyers To: Joseph Myers Cc: Szabolcs Nagy , carlos , Florian Weimer , nd , Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Will Deacon , Dave Watson , Paul Turner , libc-alpha , linux-kernel , linux-api Message-ID: <466724077.8623.1537387854947.JavaMail.zimbra@efficios.com> In-Reply-To: References: <20180919144438.1066-1-mathieu.desnoyers@efficios.com> Subject: Re: [RFC PATCH] glibc: Perform rseq(2) registration at nptl init and thread creation MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.142.138] X-Mailer: Zimbra 8.8.9_GA_3019 (ZimbraWebClient - FF52 (Linux)/8.8.9_GA_3019) Thread-Topic: glibc: Perform rseq(2) registration at nptl init and thread creation Thread-Index: vItvTcgLizgp+BKg6lEwR5/B4jo/yw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ----- On Sep 19, 2018, at 3:49 PM, Joseph Myers joseph@codesourcery.com wrote: > On Wed, 19 Sep 2018, Szabolcs Nagy wrote: > >> i don't think there is precedent for exposing tls symbol in glibc >> (e.g. errno is exposed via __errno_location function) so there >> might be issues with this (but i don't have immediate concerns). > > There have been suggestions to expose TLS errno - but also suggestions > that use of __errno_location is more efficient, at least in terms of code > size everywhere errno is accessed (for some ABIs, anyway). AFAIU, the trade-off is different between the errno use-case and the rseq use-case. If my understanding is correct, errno is not supposed to be used in fast-paths, only when an error is returned. So size is more important than speed there. Comparatively, rseq is _meant_ to speed up fast-paths. A per-cpu statistics counter can be incremented in 2ns with rseq on a Intel E5-2630, which is faster than a simple function call. So for rseq, we should favor speed over space, which means the user applications and libraries would need access to the TLS symbol without requiring an accessor function. That's also why I'm using the initial-exec tls model rather than the global-dynamic: I want to make sure no function call is generated there. > The ABI tests have code that would list .tbss symbols as "T" in ABI test > baselines, but no existing ABI baselines use that. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com