Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1243340lql; Tue, 12 Mar 2024 11:08:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVdJC06f5LuaQ/4g5xs9wy/iTkBYRZf1OB9ftT5yXF8+IdtI0IjXtl08iBJa+tlYm/Zszaiei2+CcBoC84vWqkrkrdpWeSxdWF+qiDr4Q== X-Google-Smtp-Source: AGHT+IEme8AXJWX2/KwTAbI4r9yevWMh0bf4x2U2XV1pgvt9C7RRSjk+GnjmcslcMq7gJWFHAZae X-Received: by 2002:a17:90a:ec03:b0:29b:f909:94b4 with SMTP id l3-20020a17090aec0300b0029bf90994b4mr2628317pjy.21.1710266920654; Tue, 12 Mar 2024 11:08:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710266920; cv=pass; d=google.com; s=arc-20160816; b=LHAMeY6eg7uQsn6d/G2uhe54MJH3l41h5NFXpy5vmOsLGSyoXqfaC6uH4yHTgEaIIS CaU/6Z08oc0sJTQbLmi2Wb+qPldoyeCb+bi1Sqjjjhq1Rkakm4M93PHxXSFhY8zqs9Yh 11OQQmzvm6VP7FWSywkrpwlwmvA86jEJsUOnLtpo3aEYPkj/8M4qvFuzBU8oEZPdz3az BGnBxL80cQSaVlZcn1gUU/CdskB43GFzS6DDlKJGTDLqMpfsjCRviXS6dMthpFkzS1L0 LNJZIYNpiZIBL+TDi/AnTNaYIXFt7s2XFmjzMyil86FBML1tWyCpPt9pzNB8oCfmyoub HIXQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :dkim-signature:dkim-signature:from; bh=ofnsWQdHNBIT62/BSireKZzq3CrT3bJvHhWQMH0KupI=; fh=IokaD9Y79K/b7J4e53Z8TVjYr5dOfZxejZSdHbmFFbY=; b=NYGqP2GZYO25EURDtGMXKoOWnPnDRsnLkfhh1xvrhYew2V6CJPETyFbIKR1gFF1Jcp Id2ltDhmYAF8FQX9OOCK4MGAoIOb6utYAsBnyIbDc7EfY6+VMHJb/b2t9BgRB94h+kax kBIM2q7VNvjymSsPSQq6sgVi2f359Z2KuXvp3iKrt7L4NfxaqTMhwcxx98jY/kxycCdl snUlhPWS7vUogGijaEoWyzJHRSbE/jERiFr4CPVFb1kvH8MgO5eU5sL5gHgeidGf5aNV PbYV0DSyhXv7EnCZu4TLjTNgfaTn1J7g+hSpG/80RZK3agnlbq8rdTmtg5cY+vHNkuHc ee0Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hoyig5Pu; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Si0jMMkz; 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-100628-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100628-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. [147.75.48.161]) by mx.google.com with ESMTPS id c17-20020a17090a8d1100b0029c3e321f18si1511081pjo.71.2024.03.12.11.08.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 11:08:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-100628-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=hoyig5Pu; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=Si0jMMkz; 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-100628-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-100628-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 686ABB225A2 for ; Tue, 12 Mar 2024 18:08:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56DF4139586; Tue, 12 Mar 2024 18:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="hoyig5Pu"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Si0jMMkz" 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 0CA1C53BE; Tue, 12 Mar 2024 18:08:20 +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=1710266902; cv=none; b=mUA6KcxjU6DZL9SxAVi9yKqn4T/1O4QdBjZKzMwPb+aRl/AGHMHN3kZFZbHBVP72LNWhqNbYGArEDXnKhWmXpG+QD0/8oHRK0xQZptTvS9JpX6FGbFwJTnYin3fbgcOoipD+2EMRKq2C/SfO2Y/A3mLlnKoEY3qbZgrUh0E8MAw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710266902; c=relaxed/simple; bh=qu9QpLpLoG/MHsULZWTP1NiBsuIff8uU7mCQ+STPC0g=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=tpPkS33DMRMXjV08aU1T+NXVdJ4GIsS1BUKnT6lpnidAC3c0tw6zJig5z8wizDlNDQd0H2CK0ajI6rebTVjBG4mBFaMXTLorTGdyJnczh+wZKCpLQ+ibSwdMoKCcBzLFeAQ9eNuovmbQII86fm9510m9Wpq1t6eY3GXhL44XvXs= 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=hoyig5Pu; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Si0jMMkz; 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 From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1710266899; 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; bh=ofnsWQdHNBIT62/BSireKZzq3CrT3bJvHhWQMH0KupI=; b=hoyig5PumWxLJxS4wRJgHvhyDr+IdO35rVR88jUh88WwmI64KgPMDcJP4xHpZH7/CTA1JY WvAESxfy3Mo5WScS036ocwuIu5vKd7yMLLtVB5fGkTr3/v2elIzIvQkY1x6jAP6sPl3Z99 2FCe4684yhf2Qy4+XYhtsjsg7ODl6u9DshH3vxg9RlvHSZwHJP37QP2GMc2wgEpoYB9/UK 69Thzd5K3ZnxXvuMNntIuhajJtnkiCLjN9BpOyxAE0EQCgHTeQdshdcOQnNEBVL2yfdJsr x7TKRcc0sjpP/NwF6/qaS9dt26/epQwMBcICObdCRnsgAA8oPLqlYhIFzJyxHQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1710266899; 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; bh=ofnsWQdHNBIT62/BSireKZzq3CrT3bJvHhWQMH0KupI=; b=Si0jMMkzVidrY8XUvrm2WmRSi1hnBPBp3wTSrYGrwsRtvy90OXHvpCLRZLUYgSaOCXkF+Z Q8qTozs4h0KJbQBg== To: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Marco Elver , Mark Rutland , Namhyung Kim , Peter Zijlstra , Thomas Gleixner Subject: [PATCH v2 0/4] perf: Make SIGTRAP and __perf_pending_irq() work on RT. Date: Tue, 12 Mar 2024 19:01:48 +0100 Message-ID: <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-Transfer-Encoding: quoted-printable Hi, 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=E2=80=A6v2: 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. Sebastian