lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dbbfce94-22d8-5c34-ba70-c6de2b902659@huaweicloud.com>
Date: Thu, 4 Sep 2025 10:44:32 +0800
From: Yu Kuai <yukuai1@...weicloud.com>
To: Yu Kuai <hailan@...uai.org.cn>, Christoph Hellwig <hch@...radead.org>,
 Yu Kuai <yukuai1@...weicloud.com>
Cc: colyli@...nel.org, hare@...e.de, dlemoal@...nel.org, tieren@...as.com,
 axboe@...nel.dk, tj@...nel.org, josef@...icpanda.com, song@...nel.org,
 kmo@...erainc.com, satyat@...gle.com, ebiggers@...gle.com, neil@...wn.name,
 akpm@...ux-foundation.org, linux-block@...r.kernel.org,
 linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
 linux-raid@...r.kernel.org, yi.zhang@...wei.com, yangerkun@...wei.com,
 johnny.chenyi@...wei.com, "yukuai (C)" <yukuai3@...wei.com>
Subject: Re: [PATCH RFC v3 02/15] block: add QUEUE_FLAG_BIO_ISSUE

Hi,

在 2025/09/04 0:54, Yu Kuai 写道:
> Hi,
> 
> 在 2025/9/3 21:24, Christoph Hellwig 写道:
>> On Mon, Sep 01, 2025 at 11:32:07AM +0800, Yu Kuai wrote:
>>>   static inline void blkcg_bio_issue_init(struct bio *bio)
>>>   {
>>> -    bio->issue_time_ns = blk_time_get_ns();
>>> +    struct request_queue *q = bdev_get_queue(bio->bi_bdev);
>>> +
>>> +    if (test_bit(QUEUE_FLAG_BIO_ISSUE, &q->queue_flags))
>>> +        bio->issue_time_ns = blk_time_get_ns();
>>>   }
>> Given that this is called on a bio and called from generic code
>> and not blk-mq, the flag should in the gendisk and not the queue.
>>
> ok, will change to disk, and also change set/clear the flag to
> enable/disable iolatency.

After careful consideration, I think it's better to delay
blkcg_bio_issue_init() to blk_mq_submit_bio():

- it's only used by iolatency, which can only be enabled for rq-based
disks;
- For bio that is submitted the first time, blk_cgroup_bio_start() is
called from submit_bio_no_acct_nocheck(), where q_usage_counter is not
grabbed yet, hence it's not safe to enable that flag while enabling
iolatency.

diff --git a/block/blk-core.c b/block/blk-core.c
index 4201504158a1..83c262a3dfd9 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -728,7 +728,6 @@ static void __submit_bio_noacct_mq(struct bio *bio)
  void submit_bio_noacct_nocheck(struct bio *bio)
  {
         blk_cgroup_bio_start(bio);
-       blkcg_bio_issue_init(bio);

         if (!bio_flagged(bio, BIO_TRACE_COMPLETION)) {
                 trace_block_bio_queue(bio);
diff --git a/block/blk-merge.c b/block/blk-merge.c
index 70d704615be5..5538356770a4 100644
--- a/block/blk-merge.c
+++ b/block/blk-merge.c
@@ -119,7 +119,6 @@ static struct bio *bio_submit_split(struct bio *bio, 
int split_sectors)
                         goto error;
                 }
                 split->bi_opf |= REQ_NOMERGE;
-               blkcg_bio_issue_init(split);
                 bio_chain(split, bio);
                 trace_block_split(split, bio->bi_iter.bi_sector);
                 WARN_ON_ONCE(bio_zone_write_plugging(bio));
diff --git a/block/blk-mq.c b/block/blk-mq.c
index ba3a4b77f578..030937b129a2 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -3108,7 +3108,7 @@ static bool bio_unaligned(const struct bio *bio, 
struct request_queue *q)
   * It will not queue the request if there is an error with the bio, or 
at the
   * request creation.
   */
-void blk_mq_submit_bio(struct bio *bio)
+void b k_mq_submit_bio(struct bio *bio)
  {
         struct request_queue *q = bdev_get_queue(bio->bi_bdev);
         struct blk_plug *plug = current->plug;
@@ -3168,6 +3168,9 @@ void blk_mq_submit_bio(struct bio *bio)
         if (!bio_integrity_prep(bio))
                 goto queue_exit;

+       if (test_bit(QUEUE_FLAG_BIO_ISSUE, &q->queue_flags))
+               bio->issue_time_ns = blk_time_get_ns();
+
         if (blk_mq_attempt_bio_merge(q, bio, nr_segs))
                 goto queue_exit;


> 
> Thanks,
> Kuai
> 
> .
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ