Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp940843lqp; Thu, 21 Mar 2024 23:52:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXrAajkiRBlfoLpnzrwau8V/LMjINmKuvlY2ekidsquUOK72XXMyAp8SZ1gaSSquM+2Jd+/HxW1u2bwuSo+pnVEd7H7ZEFdaHkkGmYA/w== X-Google-Smtp-Source: AGHT+IH+UTRhSvpP6joIjBtxOKj5JELt91Gvgo2gMpFZY94lzss55UtOXs4K1Z96AZotkeiiazfZ X-Received: by 2002:a05:6a20:7d93:b0:1a3:4859:1ac5 with SMTP id v19-20020a056a207d9300b001a348591ac5mr2052316pzj.3.1711090354590; Thu, 21 Mar 2024 23:52:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711090354; cv=pass; d=google.com; s=arc-20160816; b=sG43oQxX6y+0ue+Kdl4Ywqj93y+wtjT1Yts4ZYWbOk7YBAS0wxUeM8jxU3kpIguchZ MqhrpD63VDfM74nWxJs1gF4GQruvyl6/bLbyKhGnVjrFFbHgC2qSYbAqGXPWuJ4oQLMK Uxy/ulK1iQT+UzPENStT6bYdCOIlIKOHJiPdGRnFTplJZ7sXDn5YqLC5Dswd2ysAC3qm pgF6ecf1/x0W012PpA6RRx4t9a3HFzsW5Q2a4425UDoZNhhRRaRdeP/hEZ2MT56uk23I BYwt95WYur40TghTl++sTgaiuGTZ77+jlD4RvHrDAkSyD+Yx9siuWexYjFy2xjK3rqKy OYgg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:dkim-signature:dkim-signature:from; bh=hnlY1ymuqUTKAU2tKPJuN/MrGHqEs1BNfNhRgjDfv7c=; fh=shuUCmE+hQsLem2SGJGjn0zib0LKOC3uV8i8/kUZ968=; b=ViQKjHUuJeSCGZomELcuYXsI/GH92TuFYx4bhQFDEmoIvqDoIYCsmdQ7hDYoeicecP I8B1y6QddK6TTyjVBx1KhBoRBXlXo7/WFVvnhsMN4T1mE5/7CFTE5plFxlMY0D8M68IT 7dqDBJ7ko+MmbXaO8IRxDax/6Uss4o7tFLPq7KRGXCMj7IiEH912HsJZ0WNGv3IP1sAi sf0DjVB9Iosf4E7+HYDgGQsZMJkw/WScTTc9A5kZiIIDC4M3T3her8q/ke9GH/Gsd9oL pWNinsxlM0E4FgK59Wf5p+85tFAOIuhZ5/isMHLfmY6+eUuFJV5IyQeHIac6WpBnQzLI kgjg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=OfM2OJn5; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-111030-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111030-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e3-20020a17090a6f8300b0029bb32706b9si5113166pjk.47.2024.03.21.23.52.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 23:52:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111030-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=@linutronix.de header.s=2020 header.b=OfM2OJn5; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-111030-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111030-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 4A32928665A for ; Fri, 22 Mar 2024 06:52:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5B87612E72; Fri, 22 Mar 2024 06:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="OfM2OJn5"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="D5En/XVX" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 CB47D12E4E; Fri, 22 Mar 2024 06:52:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711090337; cv=none; b=A/848OsFi/yi4rO4ZzHi0k8h3yML+iSxdR4EiJl6jgIXxJFOOZAKEbc/LXViUQbXXezoeYJk1cvPa5AZjNS8eyCo4om0B0OsE9JVKlVo5loFXkuMneWy3bzqhrHwpE5/Ib1sbeKWsaNXv0Jt6mvsVLiZv1XCvVqlJQ86grRbSf8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711090337; c=relaxed/simple; bh=c/c2J0T4Njb2yEG5FXJ/KJsgOSV2WBfTuNEbXUIr2sM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lmUyc1mstjtCE/lUQYwgBRoXSUeRu12av/fQapvNOEGNHJl9LQAGV+cOl/YNMts9jDhQRqSAKxy833cy6k8WNC8VJoOsSA4Q5rD/HmqAkfAu0rfTmWhB5Aqbo+RD2VxxKHhsYEqUDU5C+Y3uA6/vOb6a6uZGBLDTg8RXutGNjFs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=OfM2OJn5; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=D5En/XVX; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1711090333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hnlY1ymuqUTKAU2tKPJuN/MrGHqEs1BNfNhRgjDfv7c=; b=OfM2OJn5IabXIDYl8vmOV2MLXD5UBzlico2CZPj6O+ZZ7CASQ3NIJm3J4Bu/2LjcX9MRvQ bChWYQOhAMaH5Y8ANmL2JvTbSh8t5XUk5lJX6tR0hVs/VNc4rxZvTl42JcxWrCksSv9vBH 6UykHfMqr/xSZr0uIU57pozfow3WdeATjEOBn1Z9Qj3nOwAY9Pe55xouOylzZxbcf73Y+q bD1ZdP2P3KMBiH5h5erepNVgT89AzRCehrT8oOjJ8DepMagb2Q58WkzPyhejPo13hlgo2S 8OWJ6jxzGbWxNhX/5gXHKUQfEeQiFALsZEQvtnYI84YL8bXvAlfi5fS90bJRIw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1711090333; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=hnlY1ymuqUTKAU2tKPJuN/MrGHqEs1BNfNhRgjDfv7c=; b=D5En/XVXaGh2CWize9oJe0opewKazr80KyguOrkAtzXDDcDOWzgQUDxXXTfW66dae5VVVv Q5YFLO8KZUd//9Dw== To: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Marco Elver , Mark Rutland , Namhyung Kim , Peter Zijlstra , Thomas Gleixner , Sebastian Andrzej Siewior , Arnaldo Carvalho de Melo Subject: [PATCH v3 3/4] perf: Remove perf_swevent_get_recursion_context() from perf_pending_task(). Date: Fri, 22 Mar 2024 07:48:23 +0100 Message-ID: <20240322065208.60456-4-bigeasy@linutronix.de> In-Reply-To: <20240322065208.60456-1-bigeasy@linutronix.de> References: <20240322065208.60456-1-bigeasy@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable perf_swevent_get_recursion_context() is supposed to avoid recursion. This requires to remain on the same CPU in order to decrement/ increment the same counter. This is done by using preempt_disable(). Having preemption disabled while sending a signal leads to locking problems on PREEMPT_RT because sighand, a spinlock_t, becomes a sleeping lock. This callback runs in task context and currently delivers only a signal to "itself". Any kind of recusrion protection in this context is not required. Remove recursion protection in perf_pending_task(). Tested-by: Marco Elver Tested-by: Arnaldo Carvalho de Melo Reported-by: Arnaldo Carvalho de Melo Signed-off-by: Sebastian Andrzej Siewior --- kernel/events/core.c | 12 ------------ 1 file changed, 12 deletions(-) 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 =3D container_of(head, struct perf_event, pendin= g_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 =3D perf_swevent_get_recursion_context(); =20 if (event->pending_work) { event->pending_work =3D 0; @@ -6800,10 +6792,6 @@ static void perf_pending_task(struct callback_head *= head) local_dec(&event->ctx->nr_pending); } =20 - if (rctx >=3D 0) - perf_swevent_put_recursion_context(rctx); - preempt_enable_notrace(); - put_event(event); } =20 --=20 2.43.0