Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2374014rwb; Sat, 8 Oct 2022 06:52:56 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Rb+LAbirV5O9lbunEZZihqOyNOU++Mm9kO4QcAWouW51F2/QOy7AZsW87+QNS/wpVC1YT X-Received: by 2002:a17:907:3201:b0:741:94f2:aeaf with SMTP id xg1-20020a170907320100b0074194f2aeafmr7879553ejb.505.1665237175921; Sat, 08 Oct 2022 06:52:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665237175; cv=none; d=google.com; s=arc-20160816; b=MBPRy0FlgdC0E/qhDYWQAyjWKYYd/BZJLzGPFbKmh8yO3S1FVwbf7x/fQa9oVdfddV yTylngmftsW6ogEOjtvotbcBJULxKTq6titcA825L+ZLLDUUMausBWsT13g9VhimLxG/ TCwJYvSjtCGNen9x6GiRUJyFncJFaxLPRLnOo0aXQSbbnSYlyD2Qncsd1xFq3qBcOSOo auaQ2jNBzq99MPLHAQV+QfhTOiQ7DqDd2sBxz4ds0+aha0Rje//qKRh2aa/E+lnT+XuA lLh3Jd6IcBaKJ5RJBA2VYRB8UUq3rU27PCGsYODaaRPu7fQ3hZzrC7urjAO8TifMDgOL HAPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1AqpcDikuJJT8s474v7vbDua4kAtza8/IGevf4nKFXc=; b=qsFeCDJUFreMjbxgJOyMmHXdoQr0loPyGHiVqVkCMNcKoAmGNt7EkyIQX7M4GrYYP/ wLbW+KA+9gg2tmxlTIGagxiJ9HXof42pTtbzfiHS8k9fGTg3Be60dLI/jDgVs8VPU8GF IWDTevRnLGTCQ1Cdqx6z8sRKFjEqHgwpl6+mNPOu0w2TzBq97A6umcIBwuGmqT7of+yR AXQWx9BteAVLaMCC5t2boZ8QvQ1Sn7hwKaPB+nXvgT3L9oDV8qUM/rk15NlMdlwYii1+ 5a7iJxJd6rBKGvo59lyBtSinPbY527oQpCMfzIqxa72jiQcv+KJwfRmqPjo8/WDKziwt bqQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=WWuA7kbA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e12-20020a056402190c00b00447ebf62410si6106096edz.2.2022.10.08.06.51.48; Sat, 08 Oct 2022 06:52:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=WWuA7kbA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229470AbiJHMmJ (ORCPT + 99 others); Sat, 8 Oct 2022 08:42:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbiJHMmH (ORCPT ); Sat, 8 Oct 2022 08:42:07 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C578740E3A; Sat, 8 Oct 2022 05:42:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=1AqpcDikuJJT8s474v7vbDua4kAtza8/IGevf4nKFXc=; b=WWuA7kbAMVy1DUlBskWANcJ9T4 tnZI20WPOmrYt45dhakCYVMbaIaH042Y3OCV7uaS8ULUsdzyX9f2n0XQU/HbiCO4aAvMzc0ybLUVh hfgVo7vd5Cbv25UJ7UF1RnmLmxloU4y51XEYGWQM1ehQPA1xKUAXAn8NVM2PYDLI+qAomw9nKZEGb UvCuh0UM6DUXS50+X/9lnyo+RcrVTbMxMqcDxF10tqzgjM49yoagaE6FHOASPUL0EIxQNCpBl2fyd y2TKQVjSN9TafZE1IQVic7S1+//nxSWbzuSapUQGXBY3xvCvvK/QzjC2P1mgz+HYYhUwq51THEBZ1 aUD92QYA==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1oh99J-001i1F-Ak; Sat, 08 Oct 2022 12:41:49 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id EF64330017D; Sat, 8 Oct 2022 14:41:47 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AC72B2BD85715; Sat, 8 Oct 2022 14:41:47 +0200 (CEST) Date: Sat, 8 Oct 2022 14:41:47 +0200 From: Peter Zijlstra To: Marco Elver Cc: Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kasan-dev@googlegroups.com, Dmitry Vyukov Subject: Re: [PATCH] perf: Fix missing SIGTRAPs Message-ID: References: <20220927121322.1236730-1-elver@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 08, 2022 at 10:41:28AM +0200, Marco Elver wrote: > The below patch to the sigtrap_threads test can repro the issue (when > run lots of them concurrently again). It also illustrates the original > problem we're trying to solve, where the event never gets rearmed again > and the test times out (doesn't happen with the almost-working fix). Excellent, that helps. Also, I'm an idiot ;-) The below seems to fix it for me. --- --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -3441,7 +3448,8 @@ static void perf_event_context_sched_out perf_pmu_disable(pmu); /* PMIs are disabled; ctx->nr_pending is stable. */ - if (local_read(&ctx->nr_pending)) { + if (local_read(&ctx->nr_pending) || + local_read(&next_ctx->nr_pending)) { /* * Must not swap out ctx when there's pending * events that rely on the ctx->task relation.