From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.52 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796174322; b=nGkK7xikqtH2rwEVPaX6Lw0XA4zanJvirfE9IhU2ojgTAi+05p9ghuLgyO+2gMx8lhWN LU369j1+1+FhwT+LXKtlnZ84SnpIXRFE3Z2SIXmFPKXsUxszoXYH13EtzZDuDFqF+Ofy1 3qF8O4q52cZK1EYgD0WZNMfVeTOioivmoGQtA0KmgA9a9otWLH6rqOREi2whUdvyq9bFS YVC/vqt86Zp7cAbJNm5ho9WX7Rx2+qmjRXhuca94gDOyoSgjr6QfVNbFcRYJL6QWjUiva /mRQNdW9EkzK/Q4S3V5F5NL65hozic+XCeIvNShohQ09KaORhcf3aud4o03EHwvovSw== 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=zbNY5YTw5DYAtq+Zr2c/0WtqcELo1lRQV+DbTu4t9O0uTgp+WPQjnjgGMh61PVjIHPnM h0MX/VzqOJY5UOQOMWCyAZW/QJVh0RYL3WLr58K9gJPvwUdi96uytjXc3k2B74forSmWO cH/sVJF2Jh6dkEI6/59ZPRHprdzMn7tY+WWWFbAPc2KT2cen73cfVrY61PdJ6qxlwC32T O/eOapsMQbokHSImtzyduenXB7cHCMvsy1RpxgnISN+qBGXqF6C+mYApVpgX705mS/Bwi y21kInpEpQBXkxpZ4XiOeZJ9A8FxdCOqZhqrKZ7WtBsZoYmgstOVMeOLKmRWNBLOsHQ== 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.52 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 12BA1606A322 for ; Wed, 2 Dec 2026 01:18:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 12BA1606A322 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-f52.google.com with SMTP id 5b1f17b1804b1-4bb64ef5a14so115689535e9.1 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=VMKXxZEwUc3s1F/nKa93SIqWPKyjtTnipZMflnKL8IB4cBxrhC8sfcKcS0jzrtMm1h 1VnV01HKAROM07urHYUaWGtTN35t6STWeZP3mzbyHFkkwVM+qfgFHWNv6ltK8kq6ijZL 1dtmssV45s59gVFfjrdl+i859UG8GJA7WI75vNpf51pQraw5QXram+BKt83n8C2aspEl IsT3fCSYL9in6CT1tQZu0U9Tg0ttlJpUtLQ+c40ZZuOfAhKh8Kqtsep/kEuoA4Y9RSoO NcxvB3KIAHKIU27We7htkuuWCCkkwAisVUwjYWOwkZT+yH1VD88LxW+DpG95XRyhd9+T N2Ig== X-Forwarded-Encrypted: i=1; AL+hErHfFbn12ZPOzQdY9F+W3YY2HIiIRPE6DV90X3dKZLi9V4JRefX8RWha9iL5oUpjj4Mb3anSUEEFR8cumLl5+bf2/9I=@vger.kernel.org X-Gm-Message-State: APuU4Z8HS6Cxh+YvOGG7vzU6j1sH+Ew8RRtEfuzA/W9jRthNzphUXkAV hcJ/Bgcdap42BopSTBsQO6FUAtYANbcIXHEveixlETWC9gXGrFKGYi7vB/qkpw== X-Gm-Gg: AZFdTZd4ZOAuC9md8V2Utrbo3GQZlKq1reZrU9zH7tbzAyb+GO+SwC4bhH0yqoK8f1I s0jrtFMpy7rOM3WPIdp8gdDy5idth14itX6TlwMmgySyAQkckupqe47+oOOe/aEah/fdLjmYFht HNguSDf9TOfr09todTE+BZSRZ3b8igCU89vA5KzS7LuxL1GgRJN/Xn0X+zur4sAqZ98drrWWdMv FPjaGRd5alRGYffSZibR/NHFjZ752twCxuLIJJrYcwxcr1er1uqw+h7BeTcypTdkZMLXZ6Ny9aK NLRhfG55W/C5RIHIlzbagmcwIZNDCTJ3YLp1IJT/0WV2cSWb1JmV+gxVp4Bo4mbwPIL7td+ON+7 ScI5gRD2WXvPdC+XCzde81WOo80G3hSxBLivzb0zbm7QAXVR1USzB7srhFEHk2TvGfGkf9n25Hs UIFCNUQY8/S1heQ0SFH8+JgYX/+BmZEeOw1mF8zjsj76kM8aRxcJQnoxMQYGkZZ5a3lWXcyW6Zp I/wCyUpevZCRY/xJbFHIwj1y2fpMfFaRBNUSYHFfpheUXJk2UCAFK3FNnIW/VizN3I2+oyedPa7 DpamVNUDWqVtDlhoBvBeVoURRmMwvn55f13zfXCT9GBMhftuOgsmEDSJ/lzU/itDXBU9TyICk/w Njn/3TOVKGOV+yDYob2sDMDdB8wULnt0WrjuI0l98RwSwxaYz+jd9SDoBf8c88H+wE3GfrcSdF5 v2DCGohe96peJYcFT5G78fvyx1b63mpSq9D+bJcHnOnM39Fbo= 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-trace-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