Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp940846lqp; Thu, 21 Mar 2024 23:52:35 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUZN6zYjUoDdW9ZepQFuulfMJ46HfSnhyDwWec5UCPjtsZSJUbNdUkJapNB8He25PUcbbINVh2pPoBuCzD6l7sll7L8BYv9fZP6LsHnBA== X-Google-Smtp-Source: AGHT+IFyQ8YlJq+YRK1n8a6U06PvR31oDhuuZnjQBLpKkjDe/P3rtltODqzm+z1cUfxmPu19n1cD X-Received: by 2002:a05:6a20:5482:b0:1a3:600b:444c with SMTP id i2-20020a056a20548200b001a3600b444cmr1901677pzk.36.1711090355042; Thu, 21 Mar 2024 23:52:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711090355; cv=pass; d=google.com; s=arc-20160816; b=DMJ+v2nwYBvWOW8kODTVXujDqsK9elPhvRXwXslWaN+QZMsg+phcBiepJlrKea7EeU hDZ9yfz5GvWTp6av/Cpm0ZoRWwGfN41pTO0KYBXRugAD83i/mPR4/mqly2f+AA08x5Oo meEHP5wlBd0Ih1fkqJvaVPnoZPiyeG4dS+CK8p3LmUP74OlGar0aoeodPSVier+k3LPu GH1NWxKo3mvIHKhxtFmf7+ivoRwc6IULBRYCWpjfbaYk4pYqKzL7g6gjBWIVIC2CAHFF 5osP/WggNxBPPAkLY28KWvfR9DnKJKjFnFhyoayNqLrLARFnoNQgm0QkzCjK6g7ifsB/ l/2A== 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=EEFbnnAVHmdwzZCxVsdsp8BUSsMIXx8yGOcnfHYn3Fk=; fh=IokaD9Y79K/b7J4e53Z8TVjYr5dOfZxejZSdHbmFFbY=; b=tx2wWe7hKeOTU1OWn2i/+su/jBM+VU5G1PXrPp1xtYIURMAcdZag4ruMtO9XKConxP AZTYG9hteWx+BAgpWkgsOEToBrh70YcXERHQztj+29BT5nhteIt0VoCNlckF45VQ3BXS xHwDPWBMCnI5lQwCmGexOVhxJspaGwJRLb7tBCLqomA+ReElus/u9+OzlxVid4Wqf4aC m8599QZ3l+OSm+zYqeBxia/Z7TIXhtuw5GDdwxKuPWtdrmIfxcEViejJflN90chLdVAF cZU8nV4in2A/iaX5tkcU+Qi9QhMU4UPFNUEkB9ALqslBaQNrBppE55HZUTmEAR3T2zOP dauA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Wdef2tgP; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=qOCqU6e6; 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-111029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111029-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id pc2-20020a17090b3b8200b002a03048823csi1458102pjb.71.2024.03.21.23.52.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 23:52:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=Wdef2tgP; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=qOCqU6e6; 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-111029-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111029-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AB960286521 for ; Fri, 22 Mar 2024 06:52:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5BB3012E73; Fri, 22 Mar 2024 06:52:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Wdef2tgP"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qOCqU6e6" 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 CCB1F12E51; Fri, 22 Mar 2024 06:52:15 +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=1711090337; cv=none; b=DDj3Tqn1Crnl9WE6NClddG4rx0qJNIcCT9S48nLL8W9juwZkwjyl+T0ODWNfrtdLTEy2gX8WFXh6bdAeQNc0X0svWVtDrGjJqtjsg6t9qXm/Azq8ISmjP4eWxQ6fyYKMCQbDs3vgfpnShUogA1epqDKA4E7TJB7SB7x+2cYYBOk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711090337; c=relaxed/simple; bh=taVimAut1RqnRtaMWo43maVz+nQQ2R8r7EJzpVStgOg=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=l+yRqyP4MoPGqYXoru+T0tqqQmP+KbaZIAem11GO/wK9kgV/K04pXVnC4AndPcrmgGVB/Ke/4hHL78fRax9xET2Rx3zlenhZ6W/sZlCWnxFYcNvu8GRnK1YLoT5gT9gI1dmLBovwWjtCAAKdDPxlTNgIzJ2qDcpB3yX0Bs8ZsqI= 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=Wdef2tgP; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qOCqU6e6; 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=1711090332; 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=EEFbnnAVHmdwzZCxVsdsp8BUSsMIXx8yGOcnfHYn3Fk=; b=Wdef2tgPLCOqGGtkx2ZVDVOVKFAxDIW4y5+c5fiioQP90MBCr2SWHLHdcOaqOhyRQX2YoZ BRBbWfA5r8VRFNbtxWV03P2ekUwchmuRqAtOx6e5taGV5aARozjR0CbelLYo15pNvuMhq5 qAzRXuys0P1Mgg7YX8v2V3YsNQ1pPCUayokC+6f+6azAs0bYP3vYZnrLigmvNyl/iRrJSc 81onx5w+SLk8VYXhiuCZNsW1pWkd8hjetlvumCPCujvxXH7QSFLaZh9Y8zSPob11NRXvR1 VoGMJb0SY0ZpRxSe2eEQwo7x1GP6nMbkzyMV18dP3wahQLYo+WL0MonKy/qKkQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1711090332; 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=EEFbnnAVHmdwzZCxVsdsp8BUSsMIXx8yGOcnfHYn3Fk=; b=qOCqU6e6MVm6EFs4oYmDEkX7krgqeTDtAWgumfWSPCHnc8yANEGsrgaHG1al3bGMi2Ud4m 9kGX4eo04W6FatCg== 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 v3 0/4] perf: Make SIGTRAP and __perf_pending_irq() work on RT. Date: Fri, 22 Mar 2024 07:48:20 +0100 Message-ID: <20240322065208.60456-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. v2=E2=80=A6v3: https://lore.kernel.org/all/20240312180814.3373778-1-bigeasy= @linutronix.de/ - Marco suggested to add a few comments - Added a comment to __perf_event_overflow() to explain why irq_work is raised in the in_nmi() case. - Added a comment to perf_event_exit_event() to explain why the pending event is deleted. 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