Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5707629ybf; Thu, 5 Mar 2020 05:41:43 -0800 (PST) X-Google-Smtp-Source: ADFU+vvjHdbPaSZ+oRQwmHDT+6lGobv/SbqiElBpYnpyg5aNXAhjRHNuqCibkEPV/DwzT5BFTr8e X-Received: by 2002:a05:6830:110:: with SMTP id i16mr6513073otp.189.1583415703837; Thu, 05 Mar 2020 05:41:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583415703; cv=none; d=google.com; s=arc-20160816; b=GemGUNdsisnu8vA2/Embl5cdfjmXD8gz597me25YnDdOiOBUZ8f9nbv3w6PGf3xtqc Jwou6F4kgdhAytlkrw14dLIPe38hHSZ2FVv9WGHuEh0iK5CKrWPaXJNdb9v3I3mQisO8 kGFpYfFJveQZ0GoXhUwdouMAXrUl/A/2TsrYMyngVY58W9/Z/6Vybzsd8HGIxmKPbj9c ZDAysiGgHZauQmdMaeviJGLpOZdOwKJc9FtqGwINGy7cPMQ1nib+fZemD71Fe5bOFfNX QgMYklWilmkwvY+tKXZeVvs6t95Lr/mTyp9v0d+SzPlVEOaHwR8b6An60n74m3ls5/yR DthA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=IfO/+p0biLG5oao9ApqZuJzggqatRYPUhxCanUh5FV0=; b=wo+CEvAUgGekmIajA8cJB2G3Ji7+f2TNuhvGRfi7nS7QFLy/1Grmc2ux27pyYnrvnz V1/BCsMGvTaV1ElFkly3YcKdaIWZRiyPcCTrt1z5A6mvpC6A+rZOBBbSu2WeHK/QFism QoMcXOH59t/D8775CsqhCjRK6kr0usC1qKWXWXhBA1bT+c5Ojbkdhy5f1OVKhxGz1Hls 0ufY3C/bav41/bQfOK1jEKxGZD5R3TeWLrkakdcK3zKcySj4E68nr7ziUX1I+RnjwmDn 4knUH271KKf23M3Mr9Amjw1dTEiOep1oh8Y8J5oGEM4LzgUhQgeDRIrCPYibZJC3nnrn VQIQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e2si341324oig.158.2020.03.05.05.41.31; Thu, 05 Mar 2020 05:41:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726004AbgCENkE (ORCPT + 99 others); Thu, 5 Mar 2020 08:40:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:58914 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbgCENkE (ORCPT ); Thu, 5 Mar 2020 08:40:04 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1DDADAFF0; Thu, 5 Mar 2020 13:40:02 +0000 (UTC) Subject: Re: [PATCH v2] xen/blkfront: fix ring info addressing To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Cc: xen-devel@lists.xenproject.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Boris Ostrovsky , Stefano Stabellini , Konrad Rzeszutek Wilk , Jens Axboe References: <20200305114044.20235-1-jgross@suse.com> <20200305124255.GW24458@Air-de-Roger.citrite.net> From: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= Message-ID: Date: Thu, 5 Mar 2020 14:40:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200305124255.GW24458@Air-de-Roger.citrite.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >> Signed-off-by: Juergen Gross >> --- >> 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é > > Can you queue this through the Xen tree? Sure. Juergen