Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1796859lql; Wed, 13 Mar 2024 08:24:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUkCO659d2JrrW9Cghfq7x6vZlvkqKLegt0+1qbP9kbgi5/P97RerIU6LHQkJWdJvUinOZWb7tcXuNGEBMqUdX7qQMJyRzyOY7WghvN/g== X-Google-Smtp-Source: AGHT+IFe902kN5hoy57HVI+kZz3j2jxcj9hSLrmP4O9L8cL1a2Lzwew/CY0/cHRIGHAV73meCeeB X-Received: by 2002:a05:6358:2619:b0:17e:6bfc:b31d with SMTP id l25-20020a056358261900b0017e6bfcb31dmr346100rwc.0.1710343456724; Wed, 13 Mar 2024 08:24:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710343456; cv=pass; d=google.com; s=arc-20160816; b=HFIYKhSU9O8YrGVhvA2AxLwxDO5iBkzWDVhA4rDamNK5WwHP6ru/UKimDaUEC+e+e3 yDZLCPfMm+ArpZA2nctsEO2ymnAavZJ9tcirB4+px3WaXzVSu9+alZhxqFUGXSCnOu17 VDq+Sa4Sdqvja6AY0dXm0nbIloYBak2T4LxcqaPYgUdurdEFpa1sXx699tO7zUPbij1L HiqNWv92bGtWpnm4cJJMdMn7186YkA2rUKWGxHC85r6VffIgzDy1lbcfyL8wARu7BT6q ftb2Zqnjmc4iJFCONCe2Ft1GMQbyfxdf9XmZ8YnxsyrVQUR7gLvRZGF0nSQWql9b724F 2ZGg== 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=P/ArOk8sH2vyM5gaeA7nN0esWKt+AhllH1umE5297Fc=; fh=iadTgjEcxnVbpRfOD6iNJQyJGQHu4ZOchbCIbLYctkE=; b=YOZFfzUKmcJf31fF8szPuFEvK+2nQ+Zz8OulXfkKJuhK4ajUM6ZDNpAJ+sdEeG/2/i mL9C/HIDtZH39W0Dt0cPa5Y7qux7GOGV1y+YGeFgAzsde8mQvIBJqzJ+qWYp/xYXUAdq bjWv96pML4QoEMXTiPShIL3+nFHDIVMhL38fp3uZj+XIDuZh5+8nHpTp10XyFUD+Bkxj zLiJtQGzA01a00SXsWeR0Yi1ARioH9tX4prdVTVXNKagVtdmPdANhNG0eq/ZZvrnyaEA C4rG6hEvAgZzX9/r5rjFzDKXPZ4CHJzjH/nz+OHtCf30uFT06TImIiY15ZcoIkt59rub WjAw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=lHQc+hr0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101673-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101673-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 1-20020a630f41000000b005d7a78810acsi9141536pgp.278.2024.03.13.08.24.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 08:24:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101673-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=lHQc+hr0; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-101673-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101673-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 F24E328451A for ; Wed, 13 Mar 2024 15:23:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 213DE46542; Wed, 13 Mar 2024 15:23:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="lHQc+hr0" 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 4C2F947A5D; Wed, 13 Mar 2024 15:23:35 +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=1710343416; cv=none; b=njp/wHzC41fQmPP+OkRaTAGU8kYxeU7yFCJ9CGz5Hr6WjE032oGRrc5KEbTjXkEVHFKjtSZCS/mMjUUb8l1HSdOycym2drrV/buJLxh9rvS0B37G1qFgJhYYkpYVBLGOHisZ+N6KqN+ymEmCgmY466TRCCmQxWJurwIlV04YtkM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710343416; c=relaxed/simple; bh=IP2p6UB0Iw0uuB5s9+1fkRSK+RhQkxmHwBeJcrGlpEI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lvMbUZEWMlRECYhVs/WaeI+ejZUwHSdWmqqK4HZkTncZYpEghn4g0w8KsMtjMaLzTlsSOW7VE8ZpyHTxt50nYNlPvTiTdUOmTQRR134/uw6x3CxujE5QoVYK8T56QCjehGgc2zQQEqLia3DTfmTbx3BubUWcGeCFhVOv28+H5l4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=lHQc+hr0; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 694F2C43390; Wed, 13 Mar 2024 15:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710343415; bh=IP2p6UB0Iw0uuB5s9+1fkRSK+RhQkxmHwBeJcrGlpEI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lHQc+hr0Wq2NFCcdKe5SfpqUwSvs9H/E+m9e7UQp5YdGl4EKoulErVB8w4ygvnxHB yT8J03v1/sQ7kcy6n5UDpDcK5m6rt9KEgbxMr5iJmf8up73XvVjuX3QlKVljupQmb/ 0Ui6N7b/mk2ZzxhgO5a+jmVkn5rubI4tIrcQX+ofgq/AW0c67NWGnyvevI5pWRQ8LD Qgm0ODhAJ2VzHWlE6XngxLY4j/45yucUpHyQFj5YyI4mJSxtkhV4t+rtB69fgvzhB1 szm3JN3CN/vh5L/OhXodECl/gighc7aF804j7a3bq01sPG0NdhkVv/Kl4eO96zGIGs 4/TKRbtYfu+kw== Date: Wed, 13 Mar 2024 12:23:32 -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 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. - Arnaldo