Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp1275916rwi; Mon, 10 Oct 2022 13:59:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4hj267Nzt7Qoc0zmi4fgE6GufftpZeLfZQrP7R2CISQh3OXtv9HKfCR7wYtutkQQxrRGGK X-Received: by 2002:a17:907:3e06:b0:733:693:600e with SMTP id hp6-20020a1709073e0600b007330693600emr15631987ejc.410.1665435551269; Mon, 10 Oct 2022 13:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665435551; cv=none; d=google.com; s=arc-20160816; b=vo1BFgO83ykHYHc1OFruCvvpfXY48rRaZIzHDVWffKNVmE+NZhjFBthKXLzAUCplbU XS/GPedZlFsH9+2kYLNRc0dJ3lhxBvXArp9IalbE2X2VgQAOF6gYeXCRq+WmzeD0n3g1 CjPF4UTSz8M7RMaUnKGBPniTcj7TvdvvmISXeGs8lMaXc9f0DvvwyW0AXGFAZB4EHxJF 3UD+dSMgmiGJ1By8RK81Iuv/DdvVFkETFPDPEg7IqwH6pcJQmVla3d/9Ucd4N4uTbQg9 I79tDx7Y5uu8K8nHQJ6cti/8VxPdsxKaisBRTInE7bW6xpMMTqVrkacXQSzWGK/3x3P7 eFVg== 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=zMCdZsgDT6lSEa4yNENSrXv8jGmGdcVyTlFDM83Wjjs=; b=0LjCfqM3KHwzRfjUGe0FXu8L6gnYIinP/Vdw6qqIGN471ob6nBY82F/XFkHfHSmL6t s+kKaJF6LCUGSMrCkhUxFemIroC/YP9aDgXbRi2mUVroga5cMR0tkeXFYk3dXHefJqWf i9LIs6vcoIQsizjwI5zLBmk8vD2uheReAkU0+NlCoYZWrgsLaRC6pDz5wf5bTDJFT3lV 6ehuCQ0L5TdT/M6Si3bgbnoxv/kVga0R9acQsjogkVB0lAJvSKmJo4o8t4/YlSYNV3eN dxyNK6sVOGahG03o4eF5JHPZ7bfyK99jItmtF4i7wWgdd9QE0i7UNLu3vH0efDXu1/c1 QjCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=hs6aPu62; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b13-20020a17090630cd00b007417c6edb0asi10058430ejb.402.2022.10.10.13.58.45; Mon, 10 Oct 2022 13:59:11 -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=@google.com header.s=20210112 header.b=hs6aPu62; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229832AbiJJUwU (ORCPT + 99 others); Mon, 10 Oct 2022 16:52:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbiJJUwS (ORCPT ); Mon, 10 Oct 2022 16:52:18 -0400 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42414356CC for ; Mon, 10 Oct 2022 13:52:17 -0700 (PDT) Received: by mail-ej1-x631.google.com with SMTP id w18so895713ejq.11 for ; Mon, 10 Oct 2022 13:52:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=zMCdZsgDT6lSEa4yNENSrXv8jGmGdcVyTlFDM83Wjjs=; b=hs6aPu62O1qNKak5PIOSldtOcEGWNOcc7PkU3A+LLI7CTzFlKbtDKUd71kE7tr6/rj JLHmezBCaCAvBubQyHUJbIvinRUZ7VdfXV1TfmppLNMgB9cMUo9hOhZEl5Bl8AutXQW0 YFEmlrrvGiCV8pvEDcJ9aRdFsU1DJLS3RPSDBCLNPv4aq9xiFgywt4K5ibVn/QcsEZn/ DBFFCN+ZIN6ovBkGfVC2C43+0YGrSe5t7wTWefBsutOtnprpz2i3tJkdYk0i+VFACLW3 yTkaFUw/69wrjLxsCf3gThFawfeu2o0XeKl3sfd62G4TrrOhZGAJcbJHsV7I3AFEgGr+ WL0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zMCdZsgDT6lSEa4yNENSrXv8jGmGdcVyTlFDM83Wjjs=; b=vjMnbnu2bDEc72DUC6VRrmSFTEKSadIdvffzjAohy/iS0Mj4j+yrZUbqxUD6zJ7BhO 3C3iK5F2x+GOddDhnQkwCWZE216raTjjlyO2DDgeBkq+7uUn8aHvXUnWn8u8Zm58Wqwz PK73GHUAhI6Cub/pyUqruHviTU1vzd9OOTGhmuqmAKHUElcZuXtcPtxvZUr2M+XGSylL ADb//b3ig1gZOUM3yLviQ9fscejj5qsLUn4FMkXA1N11BT2p/SAoArIrVjRzB4/jTbYT Gw4W0yUCiUbr1FpjkIPR1KtSx8hKxxM+RFvUQ7L3eRhDlp1TIQNdISDxGYa1a81iOIZt iYBA== X-Gm-Message-State: ACrzQf37mHuUC3Au+uwZXi1K8xJP9ZZ22HABIPNAW51YwgFQBO2jFamg lYCZe3ZERotmhTuHopeqWh68QQ== X-Received: by 2002:a17:907:75f8:b0:78d:9f95:bddf with SMTP id jz24-20020a17090775f800b0078d9f95bddfmr8880685ejc.588.1665435135679; Mon, 10 Oct 2022 13:52:15 -0700 (PDT) Received: from elver.google.com ([2a00:79e0:9c:201:a8e9:58ad:3b85:de40]) by smtp.gmail.com with ESMTPSA id c18-20020aa7d612000000b0045720965c7asm7692314edr.11.2022.10.10.13.52.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Oct 2022 13:52:15 -0700 (PDT) Date: Mon, 10 Oct 2022 22:52:08 +0200 From: Marco Elver To: Peter Zijlstra 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: User-Agent: Mutt/2.2.7 (2022-08-07) X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 02:41PM +0200, Peter Zijlstra wrote: > 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. Yup, that fixes it. Can you send a v2 with all the fixups? Just to make sure I've tested the right thing. I'll also send the patch for the selftest addition once I gave it a good spin. Thanks, -- Marco