Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp204157lqj; Wed, 10 Apr 2024 08:09:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUfMI5Q9j5SgCpVI0zJmH7qZmKwjOCuAU40wEUyyWo5oZnkgKLC18/G2I9gf8AD4Rh+Ff7D2uoKug4It/9xxNekXnobNt+ae/+VaJN+6Q== X-Google-Smtp-Source: AGHT+IHDZtFDkAUiTvjpsv6JzhZL7K2MmehvKVhxnIzc1XAJS8hxOcsdSdbUEFleOBhZHtLMqS3O X-Received: by 2002:a17:902:eccd:b0:1e2:6b74:5941 with SMTP id a13-20020a170902eccd00b001e26b745941mr3676609plh.2.1712761797298; Wed, 10 Apr 2024 08:09:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712761797; cv=pass; d=google.com; s=arc-20160816; b=Yew6W7x7MoDzbIVDcbv0fvMD5wGAess6rh8iGODtrHDHdNzI5IWz1/PrelfGPhLlOU OjEAiyOs9ppzwUvYqb8NT+jvGTwJnxXyRXQ1H3lK9VhN9aTl6Kg31QDw3OLP5+NHhiXT DVGTYLdxKRjnDYsMHPLU+j81arAj8Q060bKVDZ8v3tYiaPkQXNfxq7gjiWzAitlU3P1B WlJgyQlQP+k9alal22m7ffpYBkrBoNEMRCqPzWFMUPnL64JrtbCZo5P1639z5reGjDZR GhGYKyJEIHjSCoBeM2i8T3HgR/tyc4IKHeTBL3Rk6+BQ6Hf3Mz40nMJCOef8LRlA9D+K calg== 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:dkim-signature :dkim-signature:date; bh=YG3UNFG71SI7VV/cXkcthvTWFGFfieVr3YwF+lYyvKM=; fh=5ZgsBp531Z/TnicYuMjJd/Em595GtQzH4MQc5+/9Dho=; b=f5EtVaMD6V/5jxVM6j+gS7Roqn2h2h8uhX0aOBzNQzxnl7sH94F+60jxu3lqzRuj6J mi3nT0A5CZbWPuBdGuSqc5o+sbTCLwDlrkI/mQdNzLjeUwc8F3E4U4o8Woarl2/iLwep 8IxO5UCF3wf2rAeIBeN2zN/eM+bFmGNuaHNSljKkH+0m+RwQ/+FoN4ItM99cnlqS9uVf RzYuviyS5EcqsEgwxypdNSi/mgb+nG3hJy8jjfQrXRdm3cm1vudH2MaTXk+B7Qg6bDAG yOZS/BhHuGzLsaX6/bMY5kuWsz2hoXDyPv9uqFJ6mNhw16GYhEdvg6CjCp6y4SuzNi/i rTSA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FcyKDb6E; 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-138721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id i7-20020a170902cf0700b001e47fa9ae58si4684091plg.651.2024.04.10.08.09.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 08:09:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-138721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=FcyKDb6E; 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-138721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-138721-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 908FEB348BF for ; Wed, 10 Apr 2024 14:11:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0E85515F418; Wed, 10 Apr 2024 14:06:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="FcyKDb6E"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bEObH6fW" 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 C2ACC15DBAF; Wed, 10 Apr 2024 14:06:36 +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=1712757998; cv=none; b=giaQE2EuOL9KjeGNWDNNwH2IbGTEW7TCUMsSMdK+OlNhQbj317QaqrmAZ5iDNajwlWOJbsakoD4ti4Z7urErhjgqq7jm7jPRDOLsS8t2xQDPKZ/TXYI/Mjeb//ZVSvvPKvsI6wBVa7zZXlrfD7Hd8nGb2+/aynHeE33CnEoc/es= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712757998; c=relaxed/simple; bh=YG3UNFG71SI7VV/cXkcthvTWFGFfieVr3YwF+lYyvKM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KvRjNKSawpL3qBUiVefRWzVxcKVErtDS5x7oFmQlqm8iJUx0rnmKKUrOeFv90kF41PqV5k/IbfRVK+Z6yJnWHx8tsqEyIQM4nuJksKRcMIE4itDIYqQnHj8X4T+ngiuvygOEv9nc2C5bXvR7bmQTuCNn6fs1O7w6eVC2fBKP+aQ= 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=FcyKDb6E; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bEObH6fW; 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: Wed, 10 Apr 2024 16:06:33 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712757995; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YG3UNFG71SI7VV/cXkcthvTWFGFfieVr3YwF+lYyvKM=; b=FcyKDb6E4bYWPJy/ktmc6KpStYEOiziYCzyXgEL+DP3YXwsy1/f8fUc913/lmEdT38kEdV pcR/7uCTbmtNq85FfqyJT//utRRtHpZA7togdpMnGrfrNy1gAo5TPOopYqY8MwfaGqZb0r +7QK2WFWvj+D1FOHpbJGklLZR0zp+BKED5snqiR92qXGnGVN7bOvZXtBRzQgvG2JPjPIR7 GWR0EyTxLvpuQyeGAxRnTUx6yYs2JDn/Y6LY0BDm8EpXHkppqgubk9bGx5DHpbbZ7uoYRX gcED50gnyZXfzYt6YFX1CS3PVY4d1oK5OSzbnW9IF1JvwUjkZ5uDZ//mqwrF4g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712757995; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YG3UNFG71SI7VV/cXkcthvTWFGFfieVr3YwF+lYyvKM=; b=bEObH6fWkZ/awcDQZVhwsXdq3B0DTTDpy6ipTP9YT+nRySAFw3dBJKKM6/KDj50+yKeXsm Bu0LYFUNB8Mg4OAg== 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 2/4] perf: Enqueue SIGTRAP always via task_work. Message-ID: <20240410140633.0MHBLpMI@linutronix.de> References: <20240322065208.60456-1-bigeasy@linutronix.de> <20240322065208.60456-3-bigeasy@linutronix.de> <20240409085732.FBItbOSO@linutronix.de> <20240409134729.JpcBYOsK@linutronix.de> <20240410134702.dcWYciZB@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 Content-Transfer-Encoding: quoted-printable In-Reply-To: On 2024-04-10 16:00:17 [+0200], Frederic Weisbecker wrote: > Le Wed, Apr 10, 2024 at 03:47:02PM +0200, Sebastian Andrzej Siewior a =C3= =A9crit : > > On 2024-04-10 13:37:05 [+0200], Frederic Weisbecker wrote: > > > > Couldn't we either flush _or_ remove the task_work in perf_release(= )? > > >=20 > > > Right so the problem in perf_release() is that we may be dealing with= task works > > > of other tasks than current. In that case, task_work_cancel() is fine= if it > > > successes. But if it fails, you don't have the guarantee that the tas= k work > > > isn't concurrently running or about to run. And you have no way to kn= ow about > > > that. So then you need some sort of flushing indeed. > >=20 > > Since perf_release() preemptible, a wait/sleep for completion would be > > best (instead of flushing). >=20 > Like this then? >=20 > https://lore.kernel.org/all/202403310406.TPrIela8-lkp@intel.com/T/#m63c28= 147d8ac06b21c64d7784d49f892e06c0e50 Kind of, yes. Do we have more than one waiter? If not, maybe that rcuwait would work then. Otherwise (>1 waiter) we did establish that we may need a per-task counter for recursion handling so preempt-disable shouldn't be a problem then. The pending_work_wq must not be used outside of task context (means no hardirq or something like that). Sebastian