Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1932617lql; Wed, 13 Mar 2024 12:13:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWg30VOINZ4qucbBuKUQo520h1GIYW0S4mX2MGCvHkQkmIP93rputy8LGGjwZ7MO34ykbwN0YabX9bvnfeJxrrRoMXbINW5tQS/SkJ2xQ== X-Google-Smtp-Source: AGHT+IGk49u7JJFwF3fQyN6ulb0wg/xBQGYuLkdbVBbBctoIsx0Xa8bHnAu0O7naz3nqkDfpy3Sx X-Received: by 2002:a05:6122:910:b0:4d4:ef9:71b0 with SMTP id j16-20020a056122091000b004d40ef971b0mr1048444vka.7.1710357239514; Wed, 13 Mar 2024 12:13:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710357239; cv=pass; d=google.com; s=arc-20160816; b=cdJ66yvt3jeKUBLX5bR8PgIVYEpLzzIuJimARLQhqp6Z6ceDOGUfDiz5MO2ELBHl7c AEMvXhDiRf40NQ61FLBUJGSLsNdGupiupxvJVgtANgGzlMfO/MAHyojrUOtiHv0iVEOr FyJDyo0kFjldsTDZYTrA9CCHI7n1htelnvX4kShCsl/IYBVnFGVQ0BRa/vZIj3xcPIqm lKHVv4ake6CI3+tSHgF5MSL4SfFEW+QRBT7CPCoMaqKDzJ/9Yzzg1UZe2HpnGTBStU64 nvRItfiPrd/ofnZ1WB5cTJQuifi8flgUu/hYp691sM1Ujqg/ek5jbPQusq7xXAPm2cla bGuQ== 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=lM4Gc9F0vQtgu+xezM+ZwScokhh1cvPVPkp7+XQyQiQ=; fh=I/ByQFhjj7frMT/QVhoN+jDXxUMztXg/UcN0cTyUbaM=; b=Dj33/SXW4s5NAmuU2/Bof6WOAP9+MKDefZynIc0QaupbW/8Be0Rrz1io0YRkg1z4lD 72UuB8PEpyHL+bRmTrSczwwqx6NwrvjaRceLwKbBfAE5Xi9Jixg5Ue3tohruWkQXRPpV HynGRi9LfzDn0uxUTWDxZ6aZ0vi+VN9EI3tpXGX0+uWqAOTP9HjFJw526YHQFJBdoMRH ROwA8AqQfcQ0s006wrw+agzmfRg5tDiG28QHKMEueCU03gy45O/GVGUndZfDWbBK1YlL 6xDph58OsgRkjDZm1Lzv7xs+PcJ8KUFdco7zGrvuKmTWzM+XBAzw/Va5xXQP5vVj0nln VIOQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pfF+4e44; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102365-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102365-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id mf14-20020a0562145d8e00b006903078e18dsi10072431qvb.221.2024.03.13.12.13.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 12:13:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-102365-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pfF+4e44; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-102365-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-102365-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 4838D1C2581C for ; Wed, 13 Mar 2024 19:10:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B18C612EA; Wed, 13 Mar 2024 18:30:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pfF+4e44" 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 6AAA51A38EB; Wed, 13 Mar 2024 18:30:56 +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=1710354656; cv=none; b=Ik0YAPh6fgQanUwxuoQ9Yym0cTP3pmUkx7Mg9ybIEYljkO3CT0ZxQLY10a77cJ+wkwxr0oDMQJKqkLmKb1bLtgN9iAbubXlM98noqjWo5/bYQls6UYjcQdAFjVEEKMoXhuyPw692mXjGiTcxcywaVReSjTQtHec3T1QzRHyfYPw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710354656; c=relaxed/simple; bh=7s94+cjLLDIJusp3vjMpmy9yEPbRqXpO24U8ePfCfsc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=FFjqMVYth0Hojno+i1QlRATvlXN11AA7jQnFbA9pdr4gagHPaqXcjbTHs9QBtNnMeQMOOIliNiLkyqmNYs5QuOj8QrPixUwDrJCaFrkkJo7tV8vohl0AJHfboBGHC6ZoDb/prejPW3MSTAHbbRjWf6o9iBhhq9Wk4jXPFO3YwOY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=pfF+4e44; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C4FEC433C7; Wed, 13 Mar 2024 18:30:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710354656; bh=7s94+cjLLDIJusp3vjMpmy9yEPbRqXpO24U8ePfCfsc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pfF+4e44rtiouk4rArEjhT/DUfXRmGsjkdlO9DtYrSQ29xS1z/LqVhioHkfvD2D0S u7+254dsEa7jEXMiNbC1gaQl4shsF+4ymgLl6fqUZ7NgaD3fOeVugmtzdRHHc0ghgf TSGSk+tRrlbuPODXSn3vYev0LwrLEGVLGOxac6SuaRcrYQBVk2dHV4pqj64csmiQN3 J3RIXvloCqx2uEUKLS1qFlYXlFxsSeikgtMda9dHRJUf6RJBBiQKRXOLXvuSb35UhC RglrvS0ulH69jYCA1riUUEWDJeyIXnE4cZfPhYXogh4klpH5FkQVKqn5Xi0liHdbs9 DatFPeH3EDkXA== Date: Wed, 13 Mar 2024 15:30:52 -0300 From: Arnaldo Carvalho de Melo To: Marco Elver , Vince Weaver 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:14:28PM -0300, Arnaldo Carvalho de Melo wrote: > 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... [root@nine perf_event_tests]# diff -u results.6.8.0-rc7-rt6 results.6.8.0-rc7.sebastian-rt6+ | grep ^[+-] --- results.6.8.0-rc7-rt6 2024-03-13 15:26:37.923323518 -0300 +++ results.6.8.0-rc7.sebastian-rt6+ 2024-03-13 15:14:11.505333801 -0300 -Linux nine 6.8.0-rc7-rt6 #1 SMP PREEMPT_RT Fri Mar 8 17:36:48 -03 2024 x86_64 x86_64 x86_64 GNU/Linux +Linux nine 6.8.0-rc7.sebastian-rt6+ #2 SMP PREEMPT_RT Tue Mar 12 18:01:31 -03 2024 x86_64 x86_64 x86_64 GNU/Linux - Testing "branch-misses" generalized event... FAILED + Testing "branch-misses" generalized event... PASSED - Testing uncore events... SKIPPED + Testing uncore events... PASSED - We are running release 6.8.0-rc7-rt6 + We are running release 6.8.0-rc7.sebastian-rt6+ - Running on CPU 4 + Running on CPU 2 - Running on CPU 6 + Running on CPU 2 - Measuring on CPU 5 -Running on CPU 6 -Measuring on CPU 5 + Measuring on CPU 6 +Running on CPU 2 +Measuring on CPU 6 [root@nine perf_event_tests]# So basically: - Testing "branch-misses" generalized event... FAILED + Testing "branch-misses" generalized event... PASSED - Testing uncore events... SKIPPED + Testing uncore events... PASSED So things improved! I'll re-run to see if these results are stable... - Arnaldo