From: Matthew Wilcox <willy@infradead.org>
To: Hannes Reinecke <hare@suse.com>
Cc: Vlastimil Babka <vbabka@suse.cz>,
Boris Pismenny <borisp@nvidia.com>,
John Fastabend <john.fastabend@gmail.com>,
Jakub Kicinski <kuba@kernel.org>,
Sagi Grimberg <sagi@grimberg.me>,
"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
linux-mm@kvack.org, Harry Yoo <harry.yoo@oracle.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: Kernel oops with 6.14 when enabling TLS
Date: Tue, 4 Mar 2025 16:53:09 +0000 [thread overview]
Message-ID: <Z8cv9VKka2KBnBKV@casper.infradead.org> (raw)
In-Reply-To: <a4bbf5a7-c931-4e22-bb47-3783e4adcd23@suse.com>
On Tue, Mar 04, 2025 at 05:32:32PM +0100, Hannes Reinecke wrote:
> On 3/4/25 17:14, Matthew Wilcox wrote:
> > I thought we'd done all the work needed to get rid of these pointless
> > refcount bumps. Turns out that's only on the block side (eg commit
> > e4cc64657bec). So what does networking need in order to understand
> > that some iovecs do not need to mess with the refcount?
>
> The network stack needs to get hold of the page while transmission is
> ongoing, as there is potentially rather deep queueing involved,
> requiring several calls to sendmsg() and friends before the page is finally
> transmitted. And maybe some post-processing (checksums,
> digests, you name it), too, all of which require the page to be there.
>
> It's all so jumbled up ... personally, I would _love_ to do away with
> __iov_iter_get_pages_alloc(). Allocating a page array? Seriously?
>
> And the problem with that is that it's always takes a page(!) reference,
> completely oblivious to the fact whether you even _can_ take a page
> reference (eg for tail pages); we've hit this problem several times now
> (check for sendpage_ok() ...).
Calling get_page() / put_page() on a tail page is fine -- that just
redirects to the head page. But calling it on a slab never made any
sense; at best it gets you the equivalent of TYPESAFE_BY_RCU -- that is,
the object can be freed and reallocated, but the underlying slab will
not be reallocated to some other purpose.
> But that's not the real issue; real issue is that the page reference is
> taken down in the very bowels of __iov_iter_get_pages_alloc(), but needs
> to be undone by the _caller_. Who might (or might not) have an idea
> that he needs to drop the reference here.
> That's why there is no straightforward conversion; you need to audit
> each and every caller and try to find out where the page reference (if any)
> is dropped.
> Bah.
>
> Can't we (at the very least) leave it to the caller of
> __iov_iter_get_pages() to get a page reference (he has access to the page
> array, after all ...)? That would make the interface slightly
> better, and it'll be far more obvious to the caller what needs
> to be done.
Right, that's what happened in the block layer. We mark the bio with
BIO_PAGE_PINNED if the pincount needs to be dropped. As a transitional
period, we had BIO_PAGE_REFFED which indicated that the page refcount
needed to be dropped. Perhaps there's something similar that network
could be doing.
next prev parent reply other threads:[~2025-03-04 16:53 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <08c29e4b-2f71-4b6d-8046-27e407214d8c@suse.com>
2025-03-03 7:48 ` Hannes Reinecke
2025-03-03 11:06 ` Hannes Reinecke
2025-03-03 12:57 ` Hannes Reinecke
2025-03-03 13:57 ` Matthew Wilcox
2025-03-03 14:05 ` Hannes Reinecke
2025-03-03 14:27 ` Matthew Wilcox
2025-03-03 14:42 ` Matthew Wilcox
2025-03-03 15:12 ` Vlastimil Babka
2025-03-03 15:39 ` Hannes Reinecke
2025-03-03 15:48 ` Matthew Wilcox
2025-03-03 16:15 ` Vlastimil Babka
2025-03-03 22:02 ` Vlastimil Babka
2025-03-04 7:58 ` Hannes Reinecke
2025-03-04 8:18 ` Vlastimil Babka
2025-03-04 10:20 ` Hannes Reinecke
2025-03-04 10:26 ` Vlastimil Babka
2025-03-04 15:11 ` Hannes Reinecke
2025-03-04 15:29 ` Vlastimil Babka
2025-03-04 16:20 ` Hannes Reinecke
2025-03-04 16:14 ` Matthew Wilcox
2025-03-04 16:32 ` Hannes Reinecke
2025-03-04 16:53 ` Matthew Wilcox [this message]
2025-03-04 18:05 ` Matthew Wilcox
2025-03-04 18:31 ` Vlastimil Babka
2025-03-04 19:39 ` Hannes Reinecke
2025-03-04 19:44 ` Vlastimil Babka
2025-03-05 7:14 ` Hannes Reinecke
2025-03-05 8:20 ` Hannes Reinecke
2025-03-05 8:58 ` Vlastimil Babka
2025-03-05 11:43 ` Hannes Reinecke
2025-03-05 18:11 ` Networking people smell funny and make poor life choices Matthew Wilcox
2025-03-06 0:46 ` Cong Wang
2025-03-12 15:09 ` Christoph Hellwig
2025-03-12 18:28 ` James R. Bergsten
2025-03-13 9:43 ` David Laight
2025-03-06 9:15 ` Kernel oops with 6.14 when enabling TLS Vlastimil Babka
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=Z8cv9VKka2KBnBKV@casper.infradead.org \
--to=willy@infradead.org \
--cc=borisp@nvidia.com \
--cc=hare@suse.com \
--cc=harry.yoo@oracle.com \
--cc=john.fastabend@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvme@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=sagi@grimberg.me \
--cc=vbabka@suse.cz \
/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