Received: by 2002:ab2:3319:0:b0:1ef:7a0f:c32d with SMTP id i25csp730140lqc; Fri, 8 Mar 2024 09:58:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVxEN73DcFkIvtNv82+NTMlM+rR80jRWwK3AyvvUiTT/7PcbvMrMGWQ0gOxEHATQcl7UMc8Gvv2urXGiQJC5HhTOiMPyBBlXQhs86HjrQ== X-Google-Smtp-Source: AGHT+IF4ROTjcZ1k09iNqLMuanYzqa7Qo/RH++r0dhx+5XUX6S8ioG56av6oz3SYyUc7Tvv/OEk7 X-Received: by 2002:a17:906:35db:b0:a45:becb:6e3d with SMTP id p27-20020a17090635db00b00a45becb6e3dmr5917023ejb.20.1709920738922; Fri, 08 Mar 2024 09:58:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709920738; cv=pass; d=google.com; s=arc-20160816; b=YW432trbVasJd886Gu43GcRI1mp2yQo6qnddPs7k9K0u/yp4pu9NJZbIymbU95zmQG Qlcx0evICvCxp45V6TT2BzzfDiNxYLvNrZk/9VbHsxqXfffjS0EPIv+o/8+F1iy+oVxz UrvREzqEHgI7TBwe+xnjQN9CD7RX7sZUI/c30ZWbRbANV3GY6nNWB7VNbufO2Gwzei8U lFa72zQtB20PXIh+FWphEXFkZjJO9Y+cqNnHJzMl7DaoHY/TUgefFTsNvolUuLZB8dVi nk5mR6jr3RFxToY0s1R+oeymsHGKzKXTcMLyNk/lzJA4ywqmaBBbuFEusnzb0SoK2dS5 +2aw== 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=KGVbVzwGMjptyOBEmR5tRxK9Ir4UTrX3Zgcyetw1CtU=; fh=jrSksSmswlj50egdIIbF3r6LfMFKk6lXYMto3LEmDE4=; b=sBpPaBwy/20dIu6O8XgE3ggcKyPdZiUBAGWJO9LXBRsqhx2633CTIhQmn/Vsb3Xm/j 3vwbzU4RBNG6cRvYD1inzy6Z67IALeOTC7ytOO3Gp6/zhudnV5/A2Fm9dyT/H95+SUw7 b5xm/HRh2s6H6D6Y3cDueTjZ6K8xnE+2mNRlgCggMr8f0nv7HyW6C2kuJQOmQQsaTKkw 6vnofPKR2kzzOKJcU3XD9LyiRaaDt3Z6qvote3sKhOWOCv8ue2UQQIxKfKZd4APRZeMq 9EXennFEUx2CysC1C/AZ3tVuURimYPjxdMfyReBr7UP5DVoqkklz9oXZ6aCWo6vTuu48 eA8w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MmosQXkY; 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-97427-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97427-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id mj8-20020a170906af8800b00a45e8ceadd0si17096ejb.509.2024.03.08.09.58.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Mar 2024 09:58:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-97427-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=MmosQXkY; 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-97427-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-97427-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A71B41F228BF for ; Fri, 8 Mar 2024 17:58:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C9DA958AAF; Fri, 8 Mar 2024 17:58:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="MmosQXkY"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="W+3UTTpN" 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 9585540873; Fri, 8 Mar 2024 17:58:22 +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=1709920704; cv=none; b=YyUXUtzjMIXL9YostI4shNWH2QX4KVKuI+TpuOWUTtvc4kYcBLsfdCQa+EzD6G1WH7CyDjUUW/lawCo1dslMnzZxJySg9gnFNCKMJi9OzuygpnND77xZlemftMEHUJj8bF5rE2u2V50DgqLIicg/8PInT/zKzPQVjZLTHbYevPc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709920704; c=relaxed/simple; bh=a9DDZehV50x4XWLbjHcWEPL3CKFvwBk4n2wqrhoJtSw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IwT/D3MAW90prpD6n1/j6KVMNwhOp/IsorBRPqHQWrUA5lcoMKIlhPU/l6S/wGD709GYAMqKkqM2Fzu4ib7wzW6ipoEEySJ633m8ySpfJXMJ8thQczfKMGZw/JQM64D1kbZeKdtSc4jEYJ2zUCqVYZ+KecIxxOLaB1qGJmqMQ9E= 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=MmosQXkY; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=W+3UTTpN; 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=1709920700; 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=KGVbVzwGMjptyOBEmR5tRxK9Ir4UTrX3Zgcyetw1CtU=; b=MmosQXkYlxRCAsXVqGKBRH/btOd/i92AdfGb544G35qRBb5twLYQnwRLbU8a/2sto/mUFv iziiUykfNmCAgz8aWx9fQ8c4nRxQhJFdo/oOek5madvrXaBfJJV8d9qcj6+Uc92HE8kOdn nkosZrwSfefNBrHufniIEHsCbwsSwfnPjt0EXEhtvDRqT53Cx6lgxZz2urZ/R7IPMHS/hK 97+2X5aICCsv3v/7RuOwI060vStie0c4iHJHX8hF77M3wSF3P690P6mb/YzhrEYaikqaVu CeUYMNXtJfyjRaHHS9ozqTolPLEA9n6CHVasKk4q4sIaQvvkjml9Vcx/tFW9GA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1709920700; 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=KGVbVzwGMjptyOBEmR5tRxK9Ir4UTrX3Zgcyetw1CtU=; b=W+3UTTpNM5/kfWuzo8x4EEE8dijzJ4b58X9Llh3oW3Ba+M8lq5AZ4FMKvPOkgt0BiwBZ2V ipwsVQRqqkGhTZCA== 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 , Mark Rutland , Namhyung Kim , Peter Zijlstra , Thomas Gleixner , Sebastian Andrzej Siewior Subject: [PATCH 3/4] perf: Remove perf_swevent_get_recursion_context() from perf_pending_task(). Date: Fri, 8 Mar 2024 18:51:29 +0100 Message-ID: <20240308175810.2894694-4-bigeasy@linutronix.de> In-Reply-To: <20240308175810.2894694-1-bigeasy@linutronix.de> References: <20240308175810.2894694-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(). 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 e4a85d6d2d685..240e9b7dfd3e9 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