[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c2c1573a-8c98-4a99-64fb-1346ee724d08@suse.com>
Date: Thu, 5 Mar 2020 14:40:00 +0100
From: Jürgen Groß <jgross@...e.com>
To: Roger Pau Monné <roger.pau@...rix.com>
Cc: xen-devel@...ts.xenproject.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
Boris Ostrovsky <boris.ostrovsky@...cle.com>,
Stefano Stabellini <sstabellini@...nel.org>,
Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>,
Jens Axboe <axboe@...nel.dk>
Subject: Re: [PATCH v2] xen/blkfront: fix ring info addressing
On 05.03.20 13:42, Roger Pau Monné wrote:
> On Thu, Mar 05, 2020 at 12:40:44PM +0100, Juergen Gross wrote:
>> Commit 0265d6e8ddb890 ("xen/blkfront: limit allocated memory size to
>> actual use case") made struct blkfront_ring_info size dynamic. This is
>> fine when running with only one queue, but with multiple queues the
>> addressing of the single queues has to be adapted as the structs are
>> allocated in an array.
>>
>> Fixes: 0265d6e8ddb890 ("xen/blkfront: limit allocated memory size to actual use case")
>> Reported-by: Sander Eikelenboom <linux@...elenboom.it>
>> Signed-off-by: Juergen Gross <jgross@...e.com>
>> ---
>> V2:
>> - get rid of rinfo_ptr() helper
>> - use proper parenthesis in for_each_rinfo()
>> - rename rinfo parameter of for_each_rinfo()
>> ---
>> drivers/block/xen-blkfront.c | 79 +++++++++++++++++++++++---------------------
>> 1 file changed, 42 insertions(+), 37 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
>> index e2ad6bba2281..8e844da826db 100644
>> --- a/drivers/block/xen-blkfront.c
>> +++ b/drivers/block/xen-blkfront.c
>> @@ -213,6 +213,7 @@ struct blkfront_info
>> struct blk_mq_tag_set tag_set;
>> struct blkfront_ring_info *rinfo;
>> unsigned int nr_rings;
>> + unsigned int rinfo_size;
>> /* Save uncomplete reqs and bios for migration. */
>> struct list_head requests;
>> struct bio_list bio_list;
>> @@ -259,6 +260,18 @@ static int blkfront_setup_indirect(struct blkfront_ring_info *rinfo);
>> static void blkfront_gather_backend_features(struct blkfront_info *info);
>> static int negotiate_mq(struct blkfront_info *info);
>>
>> +#define for_each_rinfo(info, ptr, idx) \
>> + for ((ptr) = (info)->rinfo, (idx) = 0; \
>> + (idx) < (info)->nr_rings; \
>> + (idx)++, (ptr) = (void *)(ptr) + (info)->rinfo_size)
>> +
>> +static struct blkfront_ring_info *get_rinfo(struct blkfront_info *info,
>
> I still think inline should be added here, but I don't have such a
> strong opinion to block the patch on it.
I can add it if you like that better. Won't make much difference in the
end.
> Also, info should be constified AFAICT.
Yes.
>
> With at least info constified:
>
> Acked-by: Roger Pau Monné <roger.pau@...rix.com>
>
> Can you queue this through the Xen tree?
Sure.
Juergen
Powered by blists - more mailing lists