[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [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@xxxxxxxxxxxxxx>
Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
---
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@xxxxxxxxxx>

Can you queue this through the Xen tree?

Sure.


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.