From: Damien Le Moal <damien.lemoal@opensource.wdc.com>
To: "hch@infradead.org" <hch@infradead.org>,
Damien Le Moal <Damien.LeMoal@wdc.com>
Cc: "linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
Jens Axboe <axboe@kernel.dk>,
"linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
Hannes Reinecke <hare@suse.de>
Subject: Re: [PATCH v3 1/4] block: Add concurrent positioning ranges support
Date: Wed, 11 Aug 2021 08:46:54 +0900 [thread overview]
Message-ID: <53369ff7-017e-d72e-7eb6-418d6e258074@opensource.wdc.com> (raw)
In-Reply-To: <YRKjGeOZLVnTjQNv@infradead.org>
On 2021/08/11 1:02, hch@infradead.org wrote:
> On Tue, Aug 10, 2021 at 11:03:41AM +0000, Damien Le Moal wrote:
>>>> + * Dummy release function to make kobj happy.
>>>> + */
>>>> +static void blk_cranges_sysfs_nop_release(struct kobject *kobj)
>>>> +{
>>>> +}
>>>
>>> How do we ensure the kobj is still alive while it is accessed?
>>
>> q->sysfs_lock ensures that. This mutex is taken whenever revalidate registers
>> new ranges (see blk_queue_set_cranges below), and is taken also when the ranges
>> are unregistered (on revalidate if the ranges changed and when the request queue
>> is unregistered). And blk_crange_sysfs_show() takes that lock too. So the kobj
>> cannot be freed while it is being accessed (the sysfs inode lock also prevents
>> it since kobj_del() will take the inode lock).
>
> Does it? It only protects the access inside of it, but not the object
> lifetime.
Alloc & free of the cranges structure (the top kobj) are under the
q->sysfs_lock, always. With the accesses also under that same lock, this is
mutually exclusive and all protected. Furthermore, the crange
kobj_add()/kobj_del() do a kobj_get()/kobj_put() on the parent kobj, which is
the request queue kobj. So the queue cannot go away under the crange struct.
I can add a kobj_get/put for the crange struct, but I really do not see the need
for that. Or am I missing something ?
>>>> +void blk_queue_set_cranges(struct gendisk *disk, struct blk_cranges *cr)
>>>
>>> s/blk_queue/disk/
>>
>> Hmmm... The argument is a gendisk, but it is the request queue that is modified.
>> So following other functions like this, isn't blk_queue_ prefix better ?
>
> Do we have blk_queue_ functions that take a gendisk anywhere? The
> ones I noticed (and the ones I've recently added) all use disk_.
The only one I can find is blk_queue_set_zoned(), which we could probably rename
to disk_set_zoned(). There are blk_revalidate_disk_zones() and blkdev_nr_zones()
which also take a gendisk and could probably be renamed as
disk_revalidate_zones() and disk_nr_zones() for consistency.
Will rename to disk_set_cranges().
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2021-08-10 23:47 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 1:38 [PATCH v3 0/4] Initial support for multi-actuator HDDs Damien Le Moal
2021-07-26 1:38 ` [PATCH v3 1/4] block: Add concurrent positioning ranges support Damien Le Moal
2021-07-26 7:33 ` Hannes Reinecke
2021-07-26 8:30 ` Damien Le Moal
2021-07-26 8:47 ` Hannes Reinecke
2021-07-26 11:33 ` Damien Le Moal
2021-07-27 14:07 ` Paolo Valente
2021-07-27 23:44 ` Damien Le Moal
2021-08-10 8:23 ` Christoph Hellwig
2021-08-10 11:03 ` Damien Le Moal
2021-08-10 16:02 ` hch
2021-08-10 23:46 ` Damien Le Moal [this message]
2021-07-26 1:38 ` [PATCH v3 2/4] scsi: sd: add " Damien Le Moal
2021-08-10 8:24 ` Christoph Hellwig
2021-07-26 1:38 ` [PATCH v3 3/4] libata: support concurrent positioning ranges log Damien Le Moal
2021-07-26 7:34 ` Hannes Reinecke
2021-08-10 8:26 ` Christoph Hellwig
2021-07-26 1:38 ` [PATCH v3 4/4] doc: document sysfs queue/cranges attributes Damien Le Moal
2021-07-26 7:35 ` Hannes Reinecke
2021-08-10 8:27 ` Christoph Hellwig
2021-08-10 11:04 ` Damien Le Moal
2021-07-28 22:59 ` [PATCH v3 0/4] Initial support for multi-actuator HDDs Damien Le Moal
2021-08-06 2:12 ` Damien Le Moal
2021-08-06 3:41 ` Martin K. Petersen
2021-08-06 4:05 ` Damien Le Moal
2021-08-06 8:35 ` Hannes Reinecke
2021-08-06 8:52 ` Damien Le Moal
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=53369ff7-017e-d72e-7eb6-418d6e258074@opensource.wdc.com \
--to=damien.lemoal@opensource.wdc.com \
--cc=Damien.LeMoal@wdc.com \
--cc=axboe@kernel.dk \
--cc=hare@suse.de \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.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;
as well as URLs for NNTP newsgroup(s).