Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1789621lqe; Mon, 8 Apr 2024 23:25:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUhuGkmX0X0969okjh49rW+b1xPaX5SW9ptxUuPHZoEn8CMhHgSwnFwXrMO8A4ZQwtA2bIcuDoJ6W/J0UwpC3UPr/UkFaMAhDJ7DduOpQ== X-Google-Smtp-Source: AGHT+IHjjIimV/N5zANo5pyq+yJ/fVdFJ7+kATBSP2J4LiwR0eMX4Nmez6IcubBhbgiKulrkdUeJ X-Received: by 2002:a05:6a00:1915:b0:6ea:c156:f8dd with SMTP id y21-20020a056a00191500b006eac156f8ddmr10905060pfi.11.1712643914907; Mon, 08 Apr 2024 23:25:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712643914; cv=pass; d=google.com; s=arc-20160816; b=B8TgWZwsHAQCGcXRn14/0z9Ti9kaTnqAHec5UY5eB4tRjQotHYmpghdnuJfjuK9PEd y5JSBSZrD8O+iRREBpezMF9mHPmgy5rZ8G+qO6GxWjakDIWOWyukujBTQVjts8o9SD79 LWeJ5nVluVircS4Z9WMuGqX1BHRLaS17ueyGbLAvRzHJHGwyFjDvO/MkOuk2fCgkHh5q 6vBTB9NzQw8VubbFQ1MFOVaf0V8aklPY9WkX88UkGc0TULi3epNZBLmpuchwCRfjYjpu UvSngabqKh8UBpbl7bGbKcrzayj1XprJymFrIMbmInmM0+MYzrBF5c2EzmM853zLT2Zq Uiqw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:dkim-signature:date; bh=/vPx4RdY+3a57wBnjkTS4Zn0DTC9QaePnrkvMC+kGwQ=; fh=5ZgsBp531Z/TnicYuMjJd/Em595GtQzH4MQc5+/9Dho=; b=axLZRreUhAzPTFWCsXGweunI/xZSJ1wg2hlhe/3Vm8RQR7cGlh1cJjldC2MUu7OOAD GCD4eRehOWOPvcGmpw50fIMxxpJN7o+6QB4LxVbZWOmuZ0xCGCu38lNeXEX4EXtnlVxi ZjL5nV47yv5U++6d1OtStLuqrngzr8s1trbEn0+MnVhEMgbbm1UJxKw5hXp/aM4/dsG7 3D9niyqFEfuAHwyQ8GoVp15XdWmm5m7mi7ohoa42/a3RZf8D/MgQJ4yJ1hbYzH6vDd1j 4BvA0XE799INcj6XRnjUelU52tAda0LNIizlXHQYxLuXf8mNEvUF3t1i1QVHKtQpJF4/ PTNA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=qYOorJOn; 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-136295-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136295-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 f20-20020a056a00229400b006ecefed8c6fsi5323167pfe.102.2024.04.08.23.25.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 23:25:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-136295-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=qYOorJOn; 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-136295-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-136295-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 92D82284DA6 for ; Tue, 9 Apr 2024 06:25:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D9AA74E09; Tue, 9 Apr 2024 06:25:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qYOorJOn"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="DbYpmR4x" 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 E25CF6E5EC; Tue, 9 Apr 2024 06:25:04 +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=1712643906; cv=none; b=juLFPHUW+mR2rIgBAkeAS2QE5woNgaSoMIaV778KcSXZ/Br17WPnF11YNvT5lnqWjxB7QR3akOMsfAzy4ygmzadbXnEpBiNZNRI/C2YPf4byMVJH8xHlZCuQefg1B2e4DFS342KO1n5FdW2HIf0s4Br5ltxPLTkTZxNcmZdvt6o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712643906; c=relaxed/simple; bh=HlmSSCVZdQmCWnjeClGFLPha+Xz2PdZIktjA8U3QIS4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LO8KsOuMJlOumXKlcmnxwkEbunztd15RN+w4JJtZv4q8iieA4tRHDKG3Ug0FwtvZxbBEXhkSrQiHOATg7157VS8y6IE39eAVmLfV8tXUltjXc3DCsZthGu2vkUE+/Sx917QHzJEHVCGlO5qKFSoEZ2aiKC5nZbLrQhb4DDLF9w8= 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=qYOorJOn; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=DbYpmR4x; 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 Date: Tue, 9 Apr 2024 08:25:01 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712643902; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/vPx4RdY+3a57wBnjkTS4Zn0DTC9QaePnrkvMC+kGwQ=; b=qYOorJOnB6B0bVb3Ncl/WSOlP5fDi9cbsddTaUdhR6LE0B+oqKhA5wx+76CTDTIy+/Wu0v kKvTQCecM840l/Xex49+GOn7Y/NM5N283Jz0RTO9dn75e8DFSvwinKvlBifp0CrfhQBZS1 VOOsQoRcV2IojYT/2RcBWKSdWD9c2+aWQdvFrU/UXxM4m4YAO7WAJmU+qE4XQ+ySAr6GuO ybF4oapR/TpqmyDkes9ZWhidUqgDU0RY3XyOVi44tAd5l1jaVTGZqjkWRNq3lMZj18qZpZ tqiW0v/EsK5/7vM/ydcrOYhUzVts5SxfF52QxJWK3J1Z44NStzKs56a9mtpDNA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712643902; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/vPx4RdY+3a57wBnjkTS4Zn0DTC9QaePnrkvMC+kGwQ=; b=DbYpmR4xR4ny0R77fJNWxpn/2r3X7mrHHHewwpmFJeg+zSyUnP/JV0WDaewVisFTHROSCe YxW8SgW+lYxhLEDg== From: Sebastian Andrzej Siewior To: Frederic Weisbecker 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: <20240409062501.h4rA_ck4@linutronix.de> References: <20240322065208.60456-1-bigeasy@linutronix.de> <20240322065208.60456-4-bigeasy@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=utf-8 Content-Disposition: inline In-Reply-To: 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? Sebastian