Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1926293lqe; Tue, 9 Apr 2024 05:02:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWWYxZ48qEuUD0TRzeEoNIVJLVmAaUbZ+6uZSZrm7cu+oO1qjMwyXqQKkRSB4q+kac1VObP8XbZ2imXqNX1xosky54NBkWAUZqLPRxmDg== X-Google-Smtp-Source: AGHT+IF6I/oRT/HMbpAZ7RntBWDcjLBtCuX34OPN2KoD734bTgSpXL2YoRCe7k789zSLhwULRDOn X-Received: by 2002:a92:911:0:b0:36a:12d4:a5b3 with SMTP id y17-20020a920911000000b0036a12d4a5b3mr2228854ilg.8.1712664129146; Tue, 09 Apr 2024 05:02:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712664129; cv=pass; d=google.com; s=arc-20160816; b=uIs1TB9RiISoOLgcP7O++HqqX8uFNBir+vErlu+neuuE/lKOvfWBva30wwn7YY1eSQ HyUKfWqjlEQSngqINu5uBxJxoggElmbh1mhv2vNIggYwhArQPGaabaC8xC9oXiEExZBH 4sCYyYq5CxfeRhkXAtgDd5DWveUmOknKYMSccGHBRMkQEJr8xtnEGHnugrwtavvWsY1b F0FmsJxqW+a/7jWyrbqtOtfKWvYAaMhD0bLUBCXWeXAtJ4yPEYd9EViICLRNNB7kGuBa kGHAu7+bPMxv2+yWo2bDhgyi3TvP+vwsocjDBj9CHli5q9f3zJK3YEK7r9V1q2sxuzhB zK3A== 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=YklCkm2P7JneASdtIJegyxk+0HZZV9DUCLjtL4MBVho=; fh=tWedduKdZfmc5x5dPveXf04NtuTwlscpi5X/WE4lpxw=; b=pvAVdbZCl+VZCMRtPZfSDNgP1DqjwXjjpeSX0oTRl4IrdbRwD3hlTmROi4kSxSP1U9 G3JtBXmLxIRQc/+qyjxwCQWZ0dw/kZNacwODu88GXP0Fa9jV67zVD7Kjiqi9WvrpeV1y hCW0aQdU6OFo1j2bzbe4gUt7TBcJtN5Hb/RaelC8KBvJuwBwrAMraaawMWWZYxtu5j/P Or13kOcGgPvU7qbX/xLi4GuulY8j/KUJ1Tfxaoyvbow/psrSPXoHl7D60drNMLSOdpIO SNP/7TXDR1aS+T9dYxiy70ETEFB/sr82Kveum6gTQRsINrlxReVo/JVQ++pcyrSyyJ0L r1hw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vCeatPVO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-136824-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136824-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bc10-20020a0566383cca00b00482b0bd2f01si61839jab.1.2024.04.09.05.02.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 05:02:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136824-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vCeatPVO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-136824-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136824-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id C4415289F6F for ; Tue, 9 Apr 2024 12:01:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 317C212AAF0; Tue, 9 Apr 2024 12:00:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vCeatPVO" 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 5BA5786651; Tue, 9 Apr 2024 12:00:53 +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=1712664053; cv=none; b=gRpFv6PWI3uP6IY7IhmJkhI1eQi8kQqBBo99LElnRRmq8sNiMkZy/eXyG847eNHQOV0+W+oU1rjQOGfaBhFmWY0B38kFCs7cUEhQFLy6gvtPhlVQW76nQpuB/XsHEfzFcL+3uGSMUmESUMG1lv166aFof6VQdmL9eui8j234hR8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712664053; c=relaxed/simple; bh=tAyPAeaQANhI4c3tAyeCyOp+cseGWerbAlJvZtQeEac=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jVAsG53aGCe3s2IumZEYfyTu3GErtFfH4w5aK8ZblS8cMFlpLd4LszW0mWqLZtl/rxhYggQwHNwVXZa7Jk5Fqkd4qsb4Xy2EwpVz9umfmBaAcWvjHCbXqZHwC5ibMbKcODROhvL3snAOioDSoXjx3mMayRxxsbbZruJeBnjr5hQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vCeatPVO; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63AB4C433F1; Tue, 9 Apr 2024 12:00:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712664052; bh=tAyPAeaQANhI4c3tAyeCyOp+cseGWerbAlJvZtQeEac=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=vCeatPVOqX3Hx7iTF3LlEUcKobQjBcaRcBc+fJpctd/culjL8StZejl0MHXkpetUm eYa8kVtD6iizmqCJs/r5uYdajS02qAc9/rJ8H9LkYw/XYk73EC/DkPp8415WO7xGEC K1qXCt9G1iTV6jyTJsCPv7dZMZC2LL46PmD87sEL3nRwcr88pwhMVj0UNWoWMBmhAx w/AHNjgvxZV2nKPZtpUrCRfcPEvayZbDK9kja90XB4QDPjLq5HYT/ucwEVbVyfvDcc PAw6kGw4pZOX7tx8QrPZQOmj9lLbyTgD+94FH+uxRXtdJdLSk2cWy4JsjBs/t9aoqW FepHEf5w4IOZQ== Date: Tue, 9 Apr 2024 14:00:49 +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> <20240409105405.TXUU--_W@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: <20240409105405.TXUU--_W@linutronix.de> Le Tue, Apr 09, 2024 at 12:54:05PM +0200, Sebastian Andrzej Siewior a ?crit : > On 2024-04-09 12:35:46 [+0200], Frederic Weisbecker wrote: > > > > > @@ -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. > > So the perf_trace_buf_alloc() is invoked from that trace point and > avoids the recursion. And any trace event from within perf_sigtrap() > would trigger the endless loop? No sure I'm following: 1) event->perf_event_overflow() -> task_work_add() //return to userspace 2) task_work_run() -> perf_pending_task() -> perf_sigtrap() -> tracepoint event -> perf_event_overflow() -> task_work_add() 3) task_work_run() -> perf_pending_task() -> etc... What am I missing? Thanks.