From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.49 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796174322; b=1XWo2yLySSCVcf/+72SYtq+xcv34GVorTewSSY0h1gmOraV/rcR1Kvi34i4RZoZyxpWJ OOEfk4jbMHP0Xk7deA4GwZoWJuhtOpqcg4bdDkPthJQnykFUp6U2T0CWtRO6ws6WWlxEu hUqtb0oDJzvTHLM1M0FH6M6KIUxt9IJCbfeseV+IRzdzNe39392+SXRMb872I0mWNqZVr IT+HA3uhq/1Xw0a/SMwKcFtIwPjWg6oYbj48f41jGW5vSb+wK+RxN6z3M2Ftys6pPaQAL GN7bWtPocnWFlmZEmyygBEgfXg/pun1vWhkOWg9OxXvU4qCi4Kq0I++7yqIWdQyVzvA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796174322; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=+ghyuaDJJD2TeNWsd5re9JoEC7jGQ1YHrL5EOeB+t1g=; b=TfurJNNTZnDtZquamD0Rw+tsUe0vAvNyVPN8CL/HPhr9TwE0k87vjl3aefvSvxVvFTiw vIsHbwn3ZfMlKOHkLo20riQIhvffmpyVW1XtGS6dTDqUn4yckmpqzEZh5XSqLJ3a13E6C dCMTKTTbK+jw6DGcxToFU4Zlai6Ueua/ONyf0HNgKwXFUUJv3zI7GTs9k3KM96ztW43Nu kbEWwmAR6wofQhFz+8En8MQ3UWzMFAUixS+D+jbMshwsv0ismroSBZhIaCew8wcU/kaGM zUunXkliWLIX+gmoOCXKrz5GKS+V71aVBmX70MztEtIuKSrN1s2sgQUwnYrLvTo/3qg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.remote-ip=209.85.128.49 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 144F7606A323 for ; Wed, 2 Dec 2026 01:18:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 144F7606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4a214c5c4c0so119244965e9.3 for ; Tue, 01 Dec 2026 17:18:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796174310; x=1796779110; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=+ghyuaDJJD2TeNWsd5re9JoEC7jGQ1YHrL5EOeB+t1g=; b=fGBLkoNDcwmPo90AAJ7u4CJHnfA2FX7fzmA3CTKKfKXTI+YoZEgH3yJYdj9Z3u8YM9 ETT4pOJm7oWM5gJj10+SnZGP579mUyHcWdreEdIqVLiQOOtFj9zLWylkzD0Rknv3q0HM d1VRT+CP5ueugJfWnQpI9Zp01S+QphuceseXNtauWIMOE87mG05/yHx8fzS9w2cmXKCD /Kv53fAF3g6wUabPn8Qc9LL3tJqFc7JxiHNnFU1BRYl5GyqhMNSDkqrn2LJdHx6kRJw9 OE2aggBWyfUsZZGgK7V25pjSTzQHAznFl1WWkE1/5DIdvLVsVGptSIP0Hrp/RWbWZV55 MweQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796174310; x=1796779110; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=+ghyuaDJJD2TeNWsd5re9JoEC7jGQ1YHrL5EOeB+t1g=; b=Ihhqj8LZvErcKWyVC7FUeI7jDxVfZqQY+y+uoalBSFsteVKUWicl19767zVH1KtDI6 hzNdBnnV/kcST+rN3NioIItxIDacg8iAZmKFOjOGXl1aN1jnYn2sV4fpLnRIKAijpA6y G3oJejVUYtb763/RjTWcQIwh4bSBdKL9bj6eKUXvy3Q4HPg1ALLTuJG9/TNi+ETkFneZ LWiucHzw/Twk1IEjhDa4PpxmN7tN9LdkgWoQCMXSeQrqgx8zpgo9g+GennvO2CBJuCkx RWUQInxLkRROmvrCYhA+Zb0ZWm0upxaxNredAki9KD+muutYyimP8emI6MjXK0Dx51wR ayjQ== X-Forwarded-Encrypted: i=1; AL+hErGUsngXRkwssw1BCLeW7WmCnDgGoNhR9FYkLNcEFULH2hJRPTaKPmGmMLhQYrieZv9n0BMsfLD7yfPeVPw=@vger.kernel.org X-Gm-Message-State: APuU4Z8cD66dyZJiMODpRlQt0yotxvENT1qBPazmWCSX8ykTg6DqwWbp H2qjFp1e6Ghau8K3AgVGt5ekpQeCsdbrcsRQTHYVs0hcvpXDoAKusoSN X-Gm-Gg: AZFdTZfZvh8N/4hUFjjUbpHg5xmBzerfLUj2KVQHVTVXqD0+i45HLI0oNY5N6LyX7b5 72Aqv06iCCw6MkeMQeZ3Jz3EXio2xrjwtjSZW9lnSb8N8BBUgUUAZxBbJKO/3MaPBmLtlKM3Ymg y2vqWqOvu+17CGBiIPZcmvYx88infNyxgGOiTiwCccxS8dnTbF1pkV+Cc85rv/rwmjqP9AnA6Tv fRBLB3/2++nFWiF1qoSgTNfs2NbVeFierHG2Bjo5H11BrJlgpG6onoDsvCSqMNczWyUL7nNKf2D nW8RVZ4uAxTonSWoSeQtWetC95Pc9BeORF0QspjsfSC/+rwGAWW/ME44hjvhlg8XrJsDk2vdl0u aBW7zbkLZ3slEbDZxAmZDzaD+t7T2w9B5EKGa3NOIuwHCg7jIyA/mr2zw7b/aJKDWhFCtZemtA3 w/ZT4udyergfWsssn6dqqW5LIdq7p1gb552QYFIRKurBlj9KfiqiAtNLXd2lwZmkWJmCAa0+4W7 SPq4PcxDGYfD/IaNdIwsc9iNM/0rhCgGn9aDQLJ75rlm70zdHAqk3fe55j6MpsapYcqQLQBIurD d0ddOIAoPPnAk6/r/LmuxZwUybCLX7eE97whF9PNeLuPR3S5dc3B01Lr1O8mgxbY844Qh33rjMZ sd/RaD8pcu+1uSIJQd3npQ6BplhdJSbigsaAcqfQ8LLksKUXyM3E1PPkKIp9keCVUUrDWAgf4Vx 3OVcH/Iz5COS2FZ5v/IVnah+Yyer3+3B93SXAVSFoWWpyqQvM= X-Received: by 2002:a05:600c:4e87:b0:4a7:6bc7:f778 with SMTP id 5b1f17b1804b1-4bb88938d38mr793436345e9.30.1796174310300; Tue, 01 Dec 2026 17:18:30 -0800 (PST) Received: from MacBook-Pro-von-Karl.localdomain (dynamic-2a02-3100-a5c9-8d01-34fb-c870-a93e-3922.310.pool.telefonica.de. [2a02:3100:a5c9:8d01:34fb:c870:a93e:3922]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb90660cb4sm1052883905e9.2.2026.12.01.17.18.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 17:18:29 -0800 (PST) Date: Wed, 2 Dec 2026 02:18:28 +0100 From: Karl Mehltretter To: Steven Rostedt Cc: Masami Hiramatsu , Mathieu Desnoyers , Peter Zijlstra , Thomas Gleixner , Song Liu , linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] tracing: Keep preemption disabled until the recursion bit is cleared Message-ID: References: <20261113011333.20813-1-kmehltretter@gmail.com> <20261124111425.487a2ec8@gandalf.local.home> <20261130113108.293e4d1d@gandalf.local.home> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130113108.293e4d1d@gandalf.local.home> On Mon, Nov 30, 2026 at 11:31:08AM +0100, Steven Rostedt wrote: > > Would you rather drop the patch, or go with one of these? > > > > 1. Send the partial fix above as v2 (keeps your check, fixes >99%, > > leaves the two short interrupt windows). > > 2. Reorder as in my patch using small noinstr helpers for the count > > updates (closes both windows, objtool checks noinstr on x86, loses > > the runtime check, adds a helper call). > > Why are disabling preemption before the checks anyway. It's not the checks > that are causing the issue, it's the setting of the bits themselves. > > Why not this patch which disables preemption *before* setting the bits, > which should give you the same results? > This is simpler and avoids the preempt_count updates on the rejection path and gives the same results. That said, your triple-fault concern still applies here, since the recursion bit is still unset when preempt_disable_notrace() runs. I tested your patch on x86_64 (with and without VMAP_STACK) and arm64. With the transition bit disabled it matches my patch (~90% fewer recorded recursion sites) and the ftrace startup self-tests pass. On fault injection, a traced call right after preempt_disable_notrace() is still caught by the current ordering. Your version hangs with VMAP_STACK and triple-faults without it (under both TCG and KVM). Keeping the transition bit does not help. On the other hand, switching preempt_disable_notrace() to the real traced preempt_count_add() hangs the baseline too. Paths like preempt_schedule_notrace() already rely on it not being traced. So if you're fine relying on preempt_disable_notrace() staying non-instrumented, I'd rather go with your version. Thanks, Karl