linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Juergen Gross <jgross@suse.com>
Cc: <xen-devel@lists.xenproject.org>, <linux-block@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Jens Axboe <axboe@kernel.dk>
Subject: Re: [PATCH v2] xen/blkfront: fix ring info addressing
Date: Thu, 5 Mar 2020 13:42:55 +0100	[thread overview]
Message-ID: <20200305124255.GW24458@Air-de-Roger.citrite.net> (raw)
In-Reply-To: <20200305114044.20235-1-jgross@suse.com>

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@eikelenboom.it>
> Signed-off-by: Juergen Gross <jgross@suse.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.

Also, info should be constified AFAICT.

With at least info constified:

Acked-by: Roger Pau Monné <roger.pau@citrix.com>

Can you queue this through the Xen tree?

Thanks, Roger.

  reply	other threads:[~2020-03-05 12:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-05 11:40 [PATCH v2] xen/blkfront: fix ring info addressing Juergen Gross
2020-03-05 12:42 ` Roger Pau Monné [this message]
2020-03-05 13:40   ` Jürgen Groß
2020-03-05 15:47     ` [Xen-devel] " Sander Eikelenboom

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=20200305124255.GW24458@Air-de-Roger.citrite.net \
    --to=roger.pau@citrix.com \
    --cc=axboe@kernel.dk \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xenproject.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 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).