Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1934852lql; Wed, 13 Mar 2024 12:17:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVfOkAX9bUJm3zeREvuXXkShc55vA2vJ/sm+u+AlWJFiroJBCpIeyvi04QHehZgypwH/KFDwlo/YwJpAw5LArNzNoLHBljyMopxtlrxAw== X-Google-Smtp-Source: AGHT+IE7QiXazK/C+cJs9ikO79gyhEFqtz+imeP3ViG1p7qcpK5JspOqZlwzh0I+yUt5GrSpZGXW X-Received: by 2002:a17:902:e80a:b0:1dd:c93c:580c with SMTP id u10-20020a170902e80a00b001ddc93c580cmr4377087plg.4.1710357472169; Wed, 13 Mar 2024 12:17:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710357472; cv=pass; d=google.com; s=arc-20160816; b=Jmw9WMjsw4N1m1b3AKURVLEHLCqu4q3F0iq4yv9F3cU3FxJL6Xq1t9ghpXVFGumm0J oqd2/6OHJZgBUpt9zSFQO5eBreeLOTMuCJgcelUBYlAkSf74yvE7Yh01talZC94gpkCE wtzxVECIvx4JK5/0CVS2+aKL+R0jyE7UdSGD3cXgCfEXSrr6ihsSM3TBXIiKq/FExdBw 1aKqWFmER3i8E5oVZC2SFsatIgBGthStxFKuBKp70Imqldl/2oi45QNTE+sIW+kewiY3 DHrInDtfPxlN/AqHch/FuHtBkwrthdjN5puAzStGq+OvXpNbdV9k0zDZqq6INy1OnYi2 CmdA== 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=AuzuFLrjsTP4r87p35Vsy0TfVkA93IL5TjE4eQLEUTo=; fh=iadTgjEcxnVbpRfOD6iNJQyJGQHu4ZOchbCIbLYctkE=; b=vfwEWOGZTwxtdVXwXZJ/I2kZ80SJehtmlr5GQAQhJMreg3ARuRq3te9QUKWEeInuGm 1Khby2bZf5G+Xq2fcJTKmVzQ/+EpmFt7I/xHF4mZ6vIOi4WPl3SOVuedv8W6vZtQm6Po SVSI6YVhpNYEaKG792Z+DEaKyrAwOpgpOUer2FTc9OQUSmJtRhUdO4u9Gb0wLwJbSaJk Ycou/iH99c7lB2jImhNRs3xwOz7lk2Wrm1smK1rsQ0oqJOXsuL90qCaQkODwyMVJ/bw1 LbolNbA0SM8VB9yNAEU5Nwxbggfbk/aQ4Awag6JRTI19gNyjL8cgd6hu95Q9NGW12zfK l2Ww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ivF6CPGg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102339-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102339-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 a5-20020a170902ee8500b001dd774f92afsi9339038pld.513.2024.03.13.12.17.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 12:17:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102339-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=ivF6CPGg; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102339-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102339-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 78B882915BA for ; Wed, 13 Mar 2024 19:04:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35811605D2; Wed, 13 Mar 2024 18:14:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ivF6CPGg" 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 4AD2A605DE; Wed, 13 Mar 2024 18:14:31 +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=1710353673; cv=none; b=NXyLQDAMbRPc1/Wy642Ute5XCIY1qGdVla4UVv1Ib4FoqSomClHlvcWrqA681+54WvvmZP/551ETtCjHVXSb/avDw+wc7ubQWEFh+QKjgaISsZZd3OD2YAEkUWt5B+ay7mIvIeFynSn7AGLdq30TFGKQj2R07FwO8zDj8j5XJHU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710353673; c=relaxed/simple; bh=TNsbIG73NJ2s8kx6QAgm6sHZZACJCXrLFk+uu7waAMw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=QkQkQ05CVQaO99sgsrs23ZKAM8i9+/NhUnVSn5tlp/k7rawb0rrcv7nuQjaBFIb31cgfgX61cYoeMolWGjcFxclIWniXkfHf24bq4NDxJrJXLvJQVqfA8TTreBKYqGvni1PSGvK9hm+xoi+8y4g2/+dsKY3TW8pUNRwuKt5fvC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=ivF6CPGg; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D6F9C433F1; Wed, 13 Mar 2024 18:14:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710353671; bh=TNsbIG73NJ2s8kx6QAgm6sHZZACJCXrLFk+uu7waAMw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ivF6CPGgFPCX98z7CAELLpGZeuAFTB2HCZ+oVCegSk3BJ0eIiwidSX5m9sqRCtPzI wEnH5fsgQ75rFmoxFqJeEz3YAnpbD0DEQJgItbItHAB9ILD7qxhsn/GWMillLBsDc9 ChA4i3IT4anWW7MYDYIdFhGibQ4peD34IHRct3XrQCkc4Kq6YLJVKDLcL5dNxGZkrF PZIdZW9vjIYMwnVnAtsFoh+IjsTeYrUJEzDWDmI8FLVOYeOKDb8NvacfrTxQLf2FOm yClXdfNOQotjOhPWjYDpZvxKe13oSvRicj27E12i/Sis7YrLzcfy9rYys/4AQ1ygyx ZhN3+jjiSXpGg== Date: Wed, 13 Mar 2024 15:14:28 -0300 From: Arnaldo Carvalho de Melo To: Marco Elver Cc: Sebastian Andrzej Siewior , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Adrian Hunter , Alexander Shishkin , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Thomas Gleixner Subject: Re: [PATCH v2 0/4] perf: Make SIGTRAP and __perf_pending_irq() work on RT. Message-ID: References: <20240312180814.3373778-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-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, Mar 13, 2024 at 12:23:32PM -0300, Arnaldo Carvalho de Melo wrote: > On Wed, Mar 13, 2024 at 03:35:27PM +0100, Marco Elver wrote: > > On Tue, 12 Mar 2024 at 19:08, Sebastian Andrzej Siewior wrote: > > > Arnaldo reported that "perf test sigtrap" fails on PREEMPT_RT. Sending > > > the signal gets delayed until event_sched_out() which then uses > > > task_work_add() for its delivery. This breaks on PREEMPT_RT because the > > > signal is delivered with disabled preemption. > > > While looking at this, I also stumbled upon __perf_pending_irq() which > > > requires disabled interrupts but this is not the case on PREEMPT_RT. > > > This series aim to address both issues while not introducing a new issue > > > at the same time ;) > > > Any testing is appreciated. > > > v1…v2: https://lore.kernel.org/all/20240308175810.2894694-1-bigeasy@linutronix.de/ > > > - Marco pointed me to the testsuite that showed two problems: > > > - Delayed task_work from NMI / missing events. > > > Fixed by triggering dummy irq_work to enforce an interrupt for > > > the exit-to-userland path which checks task_work > > > - Increased ref-count on clean up/ during exec. > > > Mostly addressed by the former change. There is still a window > > > if the NMI occurs during execve(). This is addressed by removing > > > the task_work before free_event(). > > > The testsuite (remove_on_exec) fails sometimes if the event/ > > > SIGTRAP is sent before the sighandler is installed. > > > Tested-by: Marco Elver > > > It does pass the tests in tools/testing/selftests/perf_events (non-RT > > kernel, lockdep enabled). But I do recall this being a particularly > > sharp corner of perf, so any additional testing and review here is > > useful. > Right, I'm testing with the full 'perf test' suite now. 'perf test' doesn't show any regression, now I'm running Vince Weaver's https://github.com/deater/perf_event_tests, storing the results with this patchset and then without, to do a diff, lets see... - Arnaldo