Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1886810lqe; Tue, 9 Apr 2024 03:35:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUWxG4nlzSt/BvrwgsYkOnoHHf6ttvxgpw/iaoXHjltUnviwAUaFkwg3hAkTW5h8qsQSYr9XRDzDCm8dGjY5dsM1GfeHQ3C48c62TNl+w== X-Google-Smtp-Source: AGHT+IEbTgewrigSK0TITqPHnijQF0y+UvFdlSKYu2EyjzOgmWyZXoYdANR9mLybX3kNl23JplrU X-Received: by 2002:a50:9349:0:b0:56d:c88a:f37 with SMTP id n9-20020a509349000000b0056dc88a0f37mr7130268eda.26.1712658957536; Tue, 09 Apr 2024 03:35:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712658957; cv=pass; d=google.com; s=arc-20160816; b=iwo7fYylJ+hGeiQRb5KZujpCuugh68QwOMtxsyIVlu4thx9NG8i4uZg2G9LRikUuPJ 22oMlYnhdUa5Yo/8NQu5XoYreXu4hc8q/LAsOPbeRvahF7oHyyPAOw94zwu0McIoGNE9 OKU5YRqAGrsOAqbnCA0I629HGDBMmJfuq0VpIslfhUOHBCuCj4ZUrSdgaub6fwnL1gpC /dSvhba05MBaCXA09YK5JfN8Cuv1lmKa2xl+zoh6NCRqIptj3Zu2bOaWE9g0QNCfAVjD 6u5o7V7kq6XXXM8rB/wKl6gg/iDh0HNMClzJAblhOjoIFSB56+fIVWljqGahvWHI7NCK t8vQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=1OE+/NmkxaY89GfY2ttnxLHiyLKBPrgsnwV+QnG1aMk=; fh=tWedduKdZfmc5x5dPveXf04NtuTwlscpi5X/WE4lpxw=; b=h0XEhgdxqBoIIUlXiFkmdnS4l0/8vJLsrxksx3zUiVYjhQ9E8yADi7AAX1f4Hs/Lwq 2KMg7o6jj40mo7+i1h75N27DZtBphUxnMNXzkJesSutAWi/UPLH3cFZnACdoNGCVewsN QeuYFAsDrkCuiDfvttxetE/I4JQFtT+qaJLZxtuOCVbQcAcbje1/6eQGhEnZ/ZxKmcfg lq93XQNZlSPaHsBr7z6Ef5bwQcI5AZUvRI3WRzcZgJ8QyTxS7G6QsJAJpfCTc0lPLCjq ewPycTqiTFtIswxalt4vm5050xWrytqK6tMa8uyAhGblkmLoc5Kntz59mQ5crk0LBwcr elsw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tg43mS9k; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-136684-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136684-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a10-20020a05640213ca00b0056e520f0fe6si2770099edx.508.2024.04.09.03.35.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 03:35:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136684-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tg43mS9k; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-136684-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136684-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 45D881F22C1F for ; Tue, 9 Apr 2024 10:35:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0662B81AA5; Tue, 9 Apr 2024 10:35:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tg43mS9k" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2DC021EB46; Tue, 9 Apr 2024 10:35:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712658949; cv=none; b=tpbUVzal3+ppzplFr+849cSaLQnoomBnKvtj7M30v+hi6Aok+OLWVaDA61pxWogTqhC34ohrIR/u9qie6ME45CCPqRSx+1tDwJwS88cUe3MlK5gcr55shwtjIbq/yTORFJCLilcV3gBnTglvloS+j6hGsVr2lgcDC2pzEAIBTCI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712658949; c=relaxed/simple; bh=VtU83v3DWvkdgwKB+G89/DK3CwaUjxGtmhjxn0puGsE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ver0O2a7yPSohgHutzDNssst6689gmdH6LqvJ6VZEbNc2nkLWbddwWoz+pgGY3ba3AhTdAQJ5dBly8aaw8VejiTg2fprOYdO+SSw/Uxzv5GN39PFhPWIE2Ot4JtJ24jar8wK6J3MdFE7xTE+szPqA04ikuILGF4XTMVph6mRF+M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tg43mS9k; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6876AC433F1; Tue, 9 Apr 2024 10:35:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712658948; bh=VtU83v3DWvkdgwKB+G89/DK3CwaUjxGtmhjxn0puGsE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tg43mS9kXZIXZvrq/9CZMbPD0lSXpOJRDmWZ2vTZcZNmU1Ydu6b7qkeTOrg7EqsU5 NpOaqhJOcnWbi0E1cZ4rc7RWiMsMZDfu+FLsrebBVGmeHXC9NnnQQql/98iMOEC+bT 9Vt3oPrIfe/6rvxEhoHlUxW4N1FxjjCIJNe5NMgEhDwMGKPTJNsevaHqSyjyPnJSR/ ChvnkD/69zdi8BwIkb1LlW8YHqlGW2GxkLYFACLate0fJ0mxnolEtyMncr1evVV4Ir yw7CtSp/KUgH4auNBkn7JcPZTvsu4fmr+Ny0NPStYt7lGslfhmbrZvYl/0hVRTGE8b IA0IWtYJZINnw== Date: Tue, 9 Apr 2024 12:35:46 +0200 From: Frederic Weisbecker To: Sebastian Andrzej Siewior Cc: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Marco Elver , Mark Rutland , Namhyung Kim , Peter Zijlstra , Thomas Gleixner , Arnaldo Carvalho de Melo Subject: Re: [PATCH v3 3/4] perf: Remove perf_swevent_get_recursion_context() from perf_pending_task(). Message-ID: References: <20240322065208.60456-1-bigeasy@linutronix.de> <20240322065208.60456-4-bigeasy@linutronix.de> <20240409062501.h4rA_ck4@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240409062501.h4rA_ck4@linutronix.de> Le Tue, Apr 09, 2024 at 08:25:01AM +0200, Sebastian Andrzej Siewior a ?crit : > On 2024-04-09 00:06:00 [+0200], Frederic Weisbecker wrote: > > > diff --git a/kernel/events/core.c b/kernel/events/core.c > > > index e0b2da8de485f..5400f7ed2f98b 100644 > > > --- a/kernel/events/core.c > > > +++ b/kernel/events/core.c > > > @@ -6785,14 +6785,6 @@ static void perf_pending_irq(struct irq_work *entry) > > > static void perf_pending_task(struct callback_head *head) > > > { > > > struct perf_event *event = container_of(head, struct perf_event, pending_task); > > > - int rctx; > > > - > > > - /* > > > - * If we 'fail' here, that's OK, it means recursion is already disabled > > > - * and we won't recurse 'further'. > > > - */ > > > - preempt_disable_notrace(); > > > - rctx = perf_swevent_get_recursion_context(); > > > > > > if (event->pending_work) { > > > event->pending_work = 0; > > > @@ -6800,10 +6792,6 @@ static void perf_pending_task(struct callback_head *head) > > > local_dec(&event->ctx->nr_pending); > > > } > > > > > > - if (rctx >= 0) > > > - perf_swevent_put_recursion_context(rctx); > > > - preempt_enable_notrace(); > > > > Well, if a software event happens during perf_sigtrap(), the task work > > may be requeued endlessly and the task may get stuck in task_work_run()... > > The last time I checked it had no users in the task context. How would > that happen? I guess many tracepoint events would do the trick. Such as trace_lock_acquire() for example. Thanks.