From: Vlastimil Babka <vbabka@suse.cz>
To: Hannes Reinecke <hare@suse.de>,
Matthew Wilcox <willy@infradead.org>,
Hannes Reinecke <hare@suse.com>
Cc: 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 20:44:43 +0100 [thread overview]
Message-ID: <27111897-0b36-4d8c-8be9-4f8bdbae88b7@suse.cz> (raw)
In-Reply-To: <d9f4b78e-01d7-4d1d-8302-ed18d22754e4@suse.de>
On 3/4/25 20:39, Hannes Reinecke wrote:
> On 3/4/25 19:05, Matthew Wilcox wrote:
>> On Tue, Mar 04, 2025 at 04:53:09PM +0000, Matthew Wilcox wrote:
>>> 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.
>>
>> Until that time ... how does this look as a quick hack to avoid
>> reverting the slab change?
>>
>> diff --git a/include/linux/mm.h b/include/linux/mm.h
>> index d6fed25243c3..ca08a923ac6d 100644
>> --- a/include/linux/mm.h
>> +++ b/include/linux/mm.h
>> @@ -1520,7 +1520,10 @@ static inline void folio_get(struct folio *folio)
>>
>> static inline void get_page(struct page *page)
>> {
>> - folio_get(page_folio(page));
>> + struct folio *folio = page_folio(page);
>> + if (WARN_ON_ONCE(folio_test_slab(folio)))
>> + return;
>> + folio_get(folio);
>> }
>>
>> static inline __must_check bool try_get_page(struct page *page)
>> @@ -1614,6 +1617,8 @@ static inline void put_page(struct page *page)
>> {
>> struct folio *folio = page_folio(page);
>>
>> + if (folio_test_slab(folio))
>> + return;
>> folio_put(folio);
>> }
>>
>> diff --git a/lib/iov_iter.c b/lib/iov_iter.c
>> index 65f550cb5081..8c7fdb7d8c8f 100644
>> --- a/lib/iov_iter.c
>> +++ b/lib/iov_iter.c
>> @@ -1190,8 +1190,12 @@ static ssize_t __iov_iter_get_pages_alloc(struct iov_iter *i,
>> if (!n)
>> return -ENOMEM;
>> p = *pages;
>> - for (int k = 0; k < n; k++)
>> - get_page(p[k] = page + k);
>> + for (int k = 0; k < n; k++) {
>> + struct folio *folio = page_folio(page);
>> + p[k] = page + k;
>> + if (!folio_test_slab(folio))
>> + folio_get(folio);
>> + }
>> maxsize = min_t(size_t, maxsize, n * PAGE_SIZE - *start);
>> i->count -= maxsize;
>> i->iov_offset += maxsize;
>>
>
> Good news and bad news ...
> Good news: TLS works again!
> Bad news: no errors.
Wait, did you add a WARN_ON_ONCE() to the put_page() as I suggested? If yes
and there was no error, it would have to be leaking the page. Or the path
uses folio_put() and we'd need to put the warning there.
> Question to the wise: this is not the only place in iov_iter.c where we
> do a 'get_page()'. Do we leave them and wait for others to report
> regressions, knowing fully well that the current code _has_ issues?
> Or shouldn't we rather clean them up?
>
> I guess the real fix would be to fiddle with the 'bio_add_page()' logic;
> we are always adding a 'page' reference to the bio, completely ignoring
> whether this page is a slab page or a normal one.
>
> Discussion at LSF, maybe?
>
> Cheers,
>
> Hannes
next prev parent reply other threads:[~2025-03-04 19:44 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
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 [this message]
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=27111897-0b36-4d8c-8be9-4f8bdbae88b7@suse.cz \
--to=vbabka@suse.cz \
--cc=borisp@nvidia.com \
--cc=hare@suse.com \
--cc=hare@suse.de \
--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=willy@infradead.org \
/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