From: Yunsheng Lin <linyunsheng@huawei.com>
To: Jason Gunthorpe <jgg@nvidia.com>
Cc: "Mina Almasry" <almasrymina@google.com>,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@google.com>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Christian König" <christian.koenig@amd.com>,
"Shakeel Butt" <shakeelb@google.com>,
"Willem de Bruijn" <willemdebruijn.kernel@gmail.com>
Subject: Re: [RFC PATCH net-next v5 2/2] net: add netmem to skb_frag_t
Date: Wed, 17 Jan 2024 17:28:44 +0800 [thread overview]
Message-ID: <5828bc7d-c876-0cad-5739-fabc436df397@huawei.com> (raw)
In-Reply-To: <20240116121611.GY734935@nvidia.com>
On 2024/1/16 20:16, Jason Gunthorpe wrote:
> On Tue, Jan 16, 2024 at 07:04:13PM +0800, Yunsheng Lin wrote:
>> On 2024/1/16 8:01, Jason Gunthorpe wrote:
>>> On Mon, Jan 15, 2024 at 03:23:33PM -0800, Mina Almasry wrote:
>>>>>> You did not answer my question that I asked here, and ignoring this
>>>>>> question is preventing us from making any forward progress on this
>>>>>> discussion. What do you expect or want skb_frag_page() to do when
>>>>>> there is no page in the frag?
>>>>>
>>>>> I would expect it to do nothing.
>>>>
>>>> I don't understand. skb_frag_page() with an empty implementation just
>>>> results in a compiler error as the function needs to return a page
>>>> pointer. Do you actually expect skb_frag_page() to unconditionally
>>>> cast frag->netmem to a page pointer? That was explained as
>>>> unacceptable over and over again by Jason and Christian as it risks
>>>> casting devmem to page; completely unacceptable and will get nacked.
>>>> Do you have a suggestion of what skb_frag_page() should do that will
>>>> not get nacked by mm?
>>>
>>> WARN_ON and return NULL seems reasonable?
>>
>> While I am agreed that it may be a nightmare to debug the case of passing
>> a false page into the mm system, but I am not sure what's the point of
>> returning NULL to caller if the caller is not expecting or handling
>> the
>
> You have to return something and NULL will largely reliably crash the
> thread. The WARN_ON explains in detail why your thread just crashed.
>
>> NULL returning[for example, most of mm API called by the networking does not
>> seems to handling NULL as input page], isn't the NULL returning will make
>> the kernel panic anyway? Doesn't it make more sense to just add a BUG_ON()
>> depending on some configuration like CONFIG_DEBUG_NET or CONFIG_DEVMEM?
>> As returning NULL seems to be causing a confusion for the caller of
>> skb_frag_page() as whether to or how to handle the NULL returning case.
>
> Possibly, though Linus doesn't like BUG_ON on principle..
From the below discussion, it seems the BUG_ON belonging to something
like below:
(a) development code where it replaces error handling that you just
haven't written yet, and you haven't really thought through all the
possibilities, so you're saying "this can't happen, I'll fix it
later".
https://linux.kernel.narkive.com/WPFYQ9d4/bug-on-in-workingset-node-shadows-dec-triggers#post6
Anyway, it would be fine for me if skb_frag_page() is not used to decide
if a normal page or a devmem is in a frag. As for the overhead of catching
the calling of skb_frag_page() for devmem frag, it would be better to avoid
it using some configuration like CONFIG_DEBUG_NET or CONFIG_DEVMEM.
>
> I think the bigger challenge is convincing people that this devmem
> stuff doesn't just open a bunch of holes in the kernel where userspace
> can crash it.
>
> The fact you all are debating what to do with skb_frag_page() suggests
> to me there isn't confidence...
>
> Jason
> .
>
next prev parent reply other threads:[~2024-01-17 9:28 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-09 1:14 [RFC PATCH net-next v5 0/2] Abstract page from net stack Mina Almasry
2024-01-09 1:14 ` [RFC PATCH net-next v5 1/2] net: introduce abstraction for network memory Mina Almasry
2024-01-10 18:45 ` Shakeel Butt
2024-01-09 1:14 ` [RFC PATCH net-next v5 2/2] net: add netmem to skb_frag_t Mina Almasry
2024-01-11 12:44 ` Yunsheng Lin
2024-01-12 0:34 ` Mina Almasry
2024-01-12 11:51 ` Yunsheng Lin
2024-01-12 15:35 ` Mina Almasry
2024-01-15 9:37 ` Yunsheng Lin
2024-01-15 23:23 ` Mina Almasry
2024-01-16 0:01 ` Jason Gunthorpe
2024-01-16 11:04 ` Yunsheng Lin
2024-01-16 12:16 ` Jason Gunthorpe
2024-01-17 9:28 ` Yunsheng Lin [this message]
2024-01-17 18:00 ` Mina Almasry
2024-01-17 18:34 ` Mina Almasry
2024-01-17 18:54 ` Willem de Bruijn
2024-01-18 8:52 ` Yunsheng Lin
2024-01-18 13:56 ` Mina Almasry
2024-01-10 2:03 ` [RFC PATCH net-next v5 0/2] Abstract page from net stack Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5828bc7d-c876-0cad-5739-fabc436df397@huawei.com \
--to=linyunsheng@huawei.com \
--cc=almasrymina@google.com \
--cc=christian.koenig@amd.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jgg@nvidia.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=shakeelb@google.com \
--cc=willemdebruijn.kernel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®