Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp4369233pxf; Tue, 23 Mar 2021 09:01:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPiqWmdsnCRTJqli/6JGRKDICUUCFMo63g9o83bPqp899MDqCr4/OhtDXSjD2yYVaOo8IW X-Received: by 2002:a05:6402:34d:: with SMTP id r13mr5281199edw.64.1616515275370; Tue, 23 Mar 2021 09:01:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616515275; cv=none; d=google.com; s=arc-20160816; b=mOygIuOdm7W8RmKGrxPQnVBKn33LJ+a6x9Sw0CI7cyTBKvzZQ0rRiXOC5TLjLKkmPy w68hR5R8YpaaE1tVDK7LBnxryU4aQgEmOeHWf1CxNUT58yDMFDHn/w0cI2tOZCqeRw1A 2bCbd1doxfn4Zz3pByBjzCg5I1Q71cA2qIJV/KMDuX+9ZNuCT+aA5mG2MJtPiBTBzuLh aQwilJXYEcUnDyCfTQJhtuywi59gq9Ga/CXhgytkhbDPPmupcSbc657JSZxiLziv/DZ8 QofTuBZmhq7nkCAaPkO4suPc64GMdxxzLERB06miBzFfCwQH7mdKx/fjnamYDOmh5RIx ezeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=cyK9GwZbrXgU/Gi6qb7KmMrpgs6Gz19VbNc5ko69Bxg=; b=zBHq0vVWcO3mGjwLkdj6uIPJR1ObNsseKcvAnse+FoQkxpk83Fd3lQoxhRCn8n3jW1 UgrKTrYefzvzI3xqFokczDY9UH1f6vysh0hZsQxvqEA98fpPuWrcruCveDUEksWZ3ctt vHgXTT9pdBTWRg8hhsVYD9OUrQ+Sz87+UHYgQqxvA1dNsgObJ9ddLB1wNn/Al9lNmEm+ 8AH4ADBmV8D/L1MxBfKfgpBGMn6smlbclOqys50eC9f6LM4iHCZt2nC+OrQ/IgAaAvGW lGAs3GkcY967QvUYui/zuqCR/nwwCS963ivYE6Ijql7raYe6W7inMyqX6IuvTR7QGE4s m5CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QvHJQk94; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s7si13792265edd.589.2021.03.23.09.00.51; Tue, 23 Mar 2021 09:01:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=QvHJQk94; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233028AbhCWP67 (ORCPT + 99 others); Tue, 23 Mar 2021 11:58:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233005AbhCWP6p (ORCPT ); Tue, 23 Mar 2021 11:58:45 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AE30C061763 for ; Tue, 23 Mar 2021 08:58:45 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id 61so21278485wrm.12 for ; Tue, 23 Mar 2021 08:58:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=cyK9GwZbrXgU/Gi6qb7KmMrpgs6Gz19VbNc5ko69Bxg=; b=QvHJQk94nhdpZIpLpS8pC7Tlh0fNSviZlXkMnUDJKnNPuSmdT6Q+5JXnCTk/6GI3x/ vgmZ6p64/5ZcKERKyFRdvkxyoLLKOl1ZRnvEUNfdOACvF02pdG+9o4e3lCAEN478L50/ YQ8o+/ZOBCMbihsgK+Kk2CHOV6Tzff9UI6A/vYu9iA23C2CdEBbuyhjXmMk9Q7vYLzD/ Yv3O/dqNSVLC3aVA4AYGW6Xg89krtqa3y0DAVsDPHVY81I5JxbHeizOlDIYe3CkUWPZx kTHQaUiZifKwn4OiJW/QSzkWIIJwEh8BFeVvares8RwnCT+ZVc/KDbWpy32VLn2vrwM4 FAlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=cyK9GwZbrXgU/Gi6qb7KmMrpgs6Gz19VbNc5ko69Bxg=; b=qgn0z91OozJW3GNw6KkhwBW8AOiTMH8DtkpqKTbp+tRAc6Sh1JOeAY7w+qCbS7FBPP xeeCkpASL3TRLiL5O7qBmMGXuBV9eKduIM/aBg4AHsibncYv+cvZpqd8o1wuUxkpUTvr ItUbtl21m1PrX+DfV065SWe2YH9zB1nLhfKuJAmwCKOqVJt4nTQ9b1AOhipMFSZbK4IA ga8V57MRMMbMHEurZfK0phRM3SOKv5V7BV4QsXSlMWRTlTxSNMO8w/qkMWPar9X7W6Mg Egy796wKSAEAN0xnvpY/TPuGSqA1488Rvm4LNUjkMD4pQBMn32H8fY8UI5Azqd1xbqAL A65Q== X-Gm-Message-State: AOAM53244hju0rRvfq7sq4PJbx/aenVgBxMUveA+fHggZ0CKytyjXK8o uHmX0ht++33S0+2bIqzLpPXiPQ== X-Received: by 2002:adf:dc91:: with SMTP id r17mr4692370wrj.293.1616515124001; Tue, 23 Mar 2021 08:58:44 -0700 (PDT) Received: from elver.google.com ([2a00:79e0:15:13:4cfd:1405:ab5d:85f8]) by smtp.gmail.com with ESMTPSA id t20sm3076962wmi.15.2021.03.23.08.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 08:58:43 -0700 (PDT) Date: Tue, 23 Mar 2021 16:58:37 +0100 From: Marco Elver To: Peter Zijlstra Cc: alexander.shishkin@linux.intel.com, acme@kernel.org, mingo@redhat.com, jolsa@redhat.com, mark.rutland@arm.com, namhyung@kernel.org, tglx@linutronix.de, glider@google.com, viro@zeniv.linux.org.uk, arnd@arndb.de, christian@brauner.io, dvyukov@google.com, jannh@google.com, axboe@kernel.dk, mascasa@google.com, pcc@google.com, irogers@google.com, kasan-dev@googlegroups.com, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH RFC v2 8/8] selftests/perf: Add kselftest for remove_on_exec Message-ID: References: <20210310104139.679618-1-elver@google.com> <20210310104139.679618-9-elver@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/2.0.5 (2021-01-21) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 23, 2021 at 03:45PM +0100, Peter Zijlstra wrote: > On Tue, Mar 23, 2021 at 11:32:03AM +0100, Peter Zijlstra wrote: > > And at that point there's very little value in still using > > perf_event_exit_event()... let me see if there's something to be done > > about that. > > I ended up with something like the below. Which then simplifies > remove_on_exec() to: > [...] > > Very lightly tested with that {1..1000} thing. > > --- > > Subject: perf: Rework perf_event_exit_event() > From: Peter Zijlstra > Date: Tue Mar 23 15:16:06 CET 2021 > > Make perf_event_exit_event() more robust, such that we can use it from > other contexts. Specifically the up and coming remove_on_exec. > > For this to work we need to address a few issues. Remove_on_exec will > not destroy the entire context, so we cannot rely on TASK_TOMBSTONE to > disable event_function_call() and we thus have to use > perf_remove_from_context(). > > When using perf_remove_from_context(), there's two races to consider. > The first is against close(), where we can have concurrent tear-down > of the event. The second is against child_list iteration, which should > not find a half baked event. > > To address this, teach perf_remove_from_context() to special case > !ctx->is_active and about DETACH_CHILD. > > Signed-off-by: Peter Zijlstra (Intel) Very nice, thanks! It seems to all hold up to testing as well. Unless you already have this on some branch somewhere, I'll prepend it to the series for now. I'll test some more and try to get v3 out tomorrow. Thanks, -- Marco