Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2255203imd; Fri, 2 Nov 2018 08:23:09 -0700 (PDT) X-Google-Smtp-Source: AJdET5dhVeExOxyrttQpATeCV3IXngCr/TPMb6B/SVkH9r6ERBd952eDWgj+GU4OtFIChp1neY3V X-Received: by 2002:a17:902:4222:: with SMTP id g31-v6mr12072794pld.236.1541172189646; Fri, 02 Nov 2018 08:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541172189; cv=none; d=google.com; s=arc-20160816; b=Nx0NeQPoeHogZtQmy/ml9jMAgxUTUqsgQl5QY1J0ob1KTYSe7uvuj5n79l3hXmuFqL ujwDDzmNZvpwfbGnyxVHdD8+KHJ4qhevHimxcLc68DSOHW5VnwSKMO/w4tuG7059RDhx Tpu9QAo6T5AekUKmzga8KtvsQW+SeXkFHIztjUhX24F5SEGpYUtJYN8+fSpCi2R5tAp4 QMCSE5vez/8WP9KlJAbZ/cpN5DsMbst/z6w4OoCsvTCQxjUQGUFiu/EdmRHqgKgGhu7Z d4c7ZgKbM79JXjdG95u78UuMhnxEcyprQYCahEyklpHc8gJp6HA2Sg7V4w9cnHOegHWL eonw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=jfPxxHk0f50f6dqCzBYwwkhAPbv53ERmyCaLkHLzhRY=; b=PmDOMaSaULClP+wkNrSbkMWYTK1ttxKY2WSezG9ZGyAHon+TLW4F29EayMQLzsZXw4 Ixw/G1vr8dkcnf9zxQstX/iAkUQm/PtBvcf4SvqBmihRK7nWM06Sfu+ZIxKvDUg4rL++ Pj/+a5D6DH3R/W+wtRYozsk5Vj0gH0+7KGk4JPhdws1dIixAHM0HLDYmBgD09TjR3BxT GpgGxaQ/d4BxgS7oqdFLdVCXXcWPcF7eP3XQnSNst54aWZqQ0WDHeokCkLxcGic1its7 YIvKw8xSmG8kuXjpK6tSdx39C9m08Su1P7T9mcz0niQ9IitXwi3/mQMmixHfOW+SGczo JR+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=bPLcXLKg; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j3-v6si4928287plk.23.2018.11.02.08.22.54; Fri, 02 Nov 2018 08:23:09 -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=@amacapital-net.20150623.gappssmtp.com header.s=20150623 header.b=bPLcXLKg; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727615AbeKCA15 (ORCPT + 99 others); Fri, 2 Nov 2018 20:27:57 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:42451 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726260AbeKCA15 (ORCPT ); Fri, 2 Nov 2018 20:27:57 -0400 Received: by mail-wr1-f65.google.com with SMTP id y15-v6so2357451wru.9 for ; Fri, 02 Nov 2018 08:20:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jfPxxHk0f50f6dqCzBYwwkhAPbv53ERmyCaLkHLzhRY=; b=bPLcXLKgjlChjHKzrE+oC6p5X/dP0JWYkFkMRuSyRH5xhfoNMwkBNL9NqIXR5mBYrd nRoEUpWf1A21KDxBavo9y/ubvx1Ril7Pn9WnSdWzcH9xZbDMpkaWBxDpYwlIBMoxUPo7 lCEsm982B1TwXpyrcsNumbRzhIacsTuonJun+yZv6NRCx3DkIyunRRkL1DdgtpbrQvrA hI/t01z2rcK5ettpETgTLQMBRScrfLqD+vrFpi6+ILth3Yw2isMkNI+LBk2KPmhJJPIC OMcGOlI5U1Ato1qLFm5o9P3+vz4WC/SpvIzs74u7o/8zZsFUvbeV0z0OfYbTUgOhLvNB xJpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jfPxxHk0f50f6dqCzBYwwkhAPbv53ERmyCaLkHLzhRY=; b=TmW+3YQHy8cux0S8N1BNpMShuNy0F3zEG3Yviuw/umXFWj49bT+Zsuhxqa4UdqsG+r cOnAySit+l+iZI1uGuhjtofCcISuR13OfoPxDCZpfskr6dfy3NK1ed0tFAghvwMQLjNy f9W8Rh1/I5rAKkLBipA0sxCtqDG75yAYPwIawdvZQkLHY0iAm+GVye0DI702ggGa8kyT Kur7EtJMSYex9TnssU45wdseREplgtL/ltWUejGMwanKlrPooDGDzvYai7pJELfSDowm IMgaa2XLqrttzstROgHXzSWS1iXVFokahAvBxT1Ap/5vmq3311cJMgBv/S1Q9k6SnYr4 gVuA== X-Gm-Message-State: AGRZ1gL9w/ihPGFWo1LvSEDBCzZXVg31GHeJMMebqyMWJwdfS5s+C/jc dAILoa9twnzuAqoJ5HiwFbnVitCRYurPCql3EOCQJw== X-Received: by 2002:adf:82c9:: with SMTP id 67-v6mr10002215wrc.131.1541172030852; Fri, 02 Nov 2018 08:20:30 -0700 (PDT) MIME-Version: 1.0 References: <20181102115259.11383-1-mathieu.desnoyers@efficios.com> In-Reply-To: <20181102115259.11383-1-mathieu.desnoyers@efficios.com> From: Andy Lutomirski Date: Fri, 2 Nov 2018 08:20:18 -0700 Message-ID: Subject: Re: [RFC PATCH 1/2] glibc: Perform rseq(2) registration at nptl init and thread creation (v3) To: Mathieu Desnoyers Cc: libc-alpha , "Carlos O'Donell" , Florian Weimer , "Joseph S. Myers" , szabolcs.nagy@arm.com, Thomas Gleixner , Ben Maurer , Peter Zijlstra , "Paul E. McKenney" , Boqun Feng , Will Deacon , Dave Watson , Paul Turner , LKML , Linux API Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 2, 2018 at 4:53 AM Mathieu Desnoyers wrote: > > Here is a third round of prototype registering rseq(2) TLS for each > thread (including main), and unregistering for each thread (excluding > main). "rseq" stands for Restartable Sequences. > > Remaining open questions: > > - How early do we want to register rseq and how late do we want to > unregister it ? It's important to consider if we expect rseq to > be used by the memory allocator and within destructor callbacks. > However, we want to be sure the TLS (__thread) area is properly > allocated across its entire use by rseq. > > - We do not need an atomic increment/decrement for the refcount per > se. Just being atomic with respect to the current thread (and nested > signals) would be enough. What is the proper API to use there ? > > See the rseq(2) man page proposed here: > https://lkml.org/lkml/2018/9/19/647 > Merely having rseq registered carries some small but nonzero overhead, right? Should this perhaps live in a librseq.so or similar (possibly built as part of libc) to avoid the overhead for programs that don't use it?