From mboxrd@z Thu Jan 1 00:00:00 1970 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 17E7D280CE5; Sun, 12 Apr 2026 16:33:49 +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=1776011630; cv=none; b=EX2GWo3V8JjSnrKVDrCXdg/lA6v5flr/FNW7eTmissnKoGGSK1XXfJI2OQoqxWzA+3pZUYdv+dtsbC/CL+3zqejiEsJMIVhT/ixJg24wnGVyJYTKatWAaF5+AD8qBlnMONk82qxz4BPsxBcmttEAOD+Mf5FkrXzGc66xJKfIbgk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776011630; c=relaxed/simple; bh=9caTNklsKH5fwtpgjJv6ZfoD6CMjftVt24Y2Ka4Zvhc=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DeQCC7aZBsOhK3NJjjGW067bP5zA+xATDu/MSoqKhRQgyRZbwFN5k4kx5Awj2eAFAovNMGGgrtIhvnxX9OWSq8SDJhjJ+RtWP+La4oKNGRNQvK2TWEmb4dkd4B/+K4EdCJ6urvBTykgf51zgo7WXyfUhwceU6u5o2/v4fO1EjXE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gjbPiP12; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gjbPiP12" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 531ECC19424; Sun, 12 Apr 2026 16:33:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1776011629; bh=9caTNklsKH5fwtpgjJv6ZfoD6CMjftVt24Y2Ka4Zvhc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=gjbPiP12XtIgGGM/XVKBjv2XyIiTq2KjSPNxHQmxOVWgOSkiMxIQkqtFxYxe2HR1Z FtQ95YwAn6wSapoXvfxOsZPbNFS9AzEQ9h//uZBIiPcwO184ITTUOyQgndaZdXjb+7 wmnXWaFfzlGkgFF2AgSmHI6uGlo+ZEuVH5sWnmZVeU81yT35U9Y1XWDe8JWepf8//O SJlc5nubMiDa3aBJGPbp7jckyUFfYQAfU23QkWdm+y7i/ZZCppdImh7f8Lfzkk8t29 luGtD2rwtTPJMFdzBqCfmSGZIXkHGItotcHJTZ8PuWO0/nIAaoQghvhRc0FWQhLQly ZPRBQV6NlhwJw== Date: Sun, 12 Apr 2026 09:33:48 -0700 From: Jakub Kicinski To: Jiayuan Chen , Eric Dumazet Cc: netdev@vger.kernel.org, "David S. Miller" , David Ahern , Paolo Abeni , Simon Horman , Weiming Shi , linux-kernel@vger.kernel.org Subject: Re: [PATCH net v2] net: fix __this_cpu_add() in preemptible code in dev_xmit_recursion_inc/dec Message-ID: <20260412093348.45ce45b0@kernel.org> In-Reply-To: <20260410020631.191786-1-jiayuan.chen@linux.dev> References: <20260410020631.191786-1-jiayuan.chen@linux.dev> 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=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 10 Apr 2026 10:06:30 +0800 Jiayuan Chen wrote: > dev_xmit_recursion_{inc,dec}() use __this_cpu_{inc,dec}() which requires > the caller to be non-preemptible in order to avoid cpu migration. However, > some callers like SCTP's UDP encapsulation path invoke iptunnel_xmit() > from process context without disabling BH or preemption: > > sctp_inet_connect -> __sctp_connect -> sctp_do_sm -> > sctp_outq_flush -> sctp_packet_transmit -> sctp_v4_xmit -> > udp_tunnel_xmit_skb -> iptunnel_xmit -> dev_xmit_recursion_inc Eric, weren't there also a bunch of RCU reports because of this path? Should we perhaps take the RCU read lock here? > + guard(migrate)(); Sorry but I detest the guard() usage. Please use migrate_disable() Quoting documentation: Use of ``guard()`` is discouraged within any function longer than 20 lines, ``scoped_guard()`` is considered more readable. Using normal lock/unlock is still (weakly) preferred. See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#using-device-managed-and-cleanup-h-constructs