From: Jens Axboe <axboe@kernel.dk>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Johannes Thumshirn <johannes.thumshirn@wdc.com>,
davem@davemloft.net, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, pabeni@redhat.com,
bpf@vger.kernel.org, Tejun Heo <tj@kernel.org>
Subject: Re: [GIT PULL] Networking for v6.9
Date: Tue, 12 Mar 2024 16:02:08 -0600 [thread overview]
Message-ID: <fee2fccf-ef4d-4595-8f20-07ba4dc67d42@kernel.dk> (raw)
In-Reply-To: <20240312145455.403b713f@kicinski-fedora-PC1C0HJN>
On 3/12/24 3:55 PM, Jakub Kicinski wrote:
> On Tue, 12 Mar 2024 14:48:06 -0700 Jakub Kicinski wrote:
>>> index 9a85bfbbc45a..646b50e1c914 100644
>>> --- a/block/blk-iocost.c
>>> +++ b/block/blk-iocost.c
>>> @@ -1044,7 +1044,7 @@ static void ioc_now(struct ioc *ioc, struct ioc_now *now)
>>> unsigned seq;
>>> u64 vrate;
>>>
>>> - now->now_ns = blk_time_get_ns();
>>> + now->now_ns = ktime_get_ns();
>>> now->now = ktime_to_us(now->now_ns);
>>> vrate = atomic64_read(&ioc->vtime_rate);
>>
>> Let me try this, 'cause doing the revert while listening to some
>> meeting is beyond me :)
>
> That fixes the crash for me!
OK good, thanks for testing! Linus, can you just pick up the below? I
can prep a pull as well, but not ready to send the remaining merge
window fixes just yet.
From fb280ede759d1918fec03bc22d32eeaaa45500bb Mon Sep 17 00:00:00 2001
From: Jens Axboe <axboe@kernel.dk>
Date: Tue, 12 Mar 2024 15:58:41 -0600
Subject: [PATCH] block: limit block time caching to in_task() context
We should not have any callers of this from non-task context, but Jakub
ran [1] into one from blk-iocost. Rather than risk running into others,
or future ones, just limit blk_time_get_ns() to when it is called from
a task. Any other usage is invalid.
[1] https://lore.kernel.org/lkml/CAHk-=wiOaBLqarS2uFhM1YdwOvCX4CZaWkeyNDY1zONpbYw2ig@mail.gmail.com/
Fixes: da4c8c3d0975 ("block: cache current nsec time in struct blk_plug")
Reported-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
block/blk.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/blk.h b/block/blk.h
index a19b7b42e650..5cac4e29ae17 100644
--- a/block/blk.h
+++ b/block/blk.h
@@ -534,7 +534,7 @@ static inline u64 blk_time_get_ns(void)
{
struct blk_plug *plug = current->plug;
- if (!plug)
+ if (!plug || !in_task())
return ktime_get_ns();
/*
--
2.43.0
--
Jens Axboe
next prev parent reply other threads:[~2024-03-12 22:02 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-12 4:25 [GIT PULL] Networking for v6.9 Jakub Kicinski
2024-03-12 20:17 ` Linus Torvalds
2024-03-12 20:34 ` Jakub Kicinski
2024-03-12 20:47 ` Jakub Kicinski
2024-03-12 21:11 ` Linus Torvalds
2024-03-12 21:40 ` Jens Axboe
2024-03-12 21:48 ` Jakub Kicinski
2024-03-12 21:53 ` Jens Axboe
2024-03-12 21:55 ` Jakub Kicinski
2024-03-12 22:02 ` Jens Axboe [this message]
2024-03-12 22:14 ` Tejun Heo
2024-03-12 22:24 ` Jakub Kicinski
2024-03-13 0:00 ` Jakub Kicinski
2024-03-13 1:00 ` Linus Torvalds
2024-03-13 1:10 ` pr-tracker-bot
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=fee2fccf-ef4d-4595-8f20-07ba4dc67d42@kernel.dk \
--to=axboe@kernel.dk \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=johannes.thumshirn@wdc.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tj@kernel.org \
--cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.