Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5654624ybf; Thu, 5 Mar 2020 04:43:47 -0800 (PST) X-Google-Smtp-Source: ADFU+vtXKiZT2EUs4lvuTQOxafFAWt+e2J6urrMNTHcsk1BXH8iEKEiPTgQOnc8ZHUDRHglDjE+d X-Received: by 2002:a05:6830:10d7:: with SMTP id z23mr6603500oto.114.1583412227749; Thu, 05 Mar 2020 04:43:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583412227; cv=none; d=google.com; s=arc-20160816; b=onF7nxbs8Q67YL9aTHVo7jg+QPWl7AdXUIfno2/mEfbZV0JoAc6F4f5yxYFaQHkKRj wsmCQ1LxqpH39f7Psl5Ig7uFUnPQQOVzQGHxHfHiVp4UyRkFMRnb2/eadj+c7/V1YHrQ wCdsb0TUqSKtKD+8IIKuq7c8qudeNIN0j0BcTUHQ49Xh9kK3z1xj05fliA6bhJhElf+j V5TWNIs6dnJOLgooW0HLSgWkhnkMMTTSPaTvRL0aL9c0b1C9VzeoiOuonUeDG8ykXtgj Wry9f258t/Ki/bu77yRUSPw/DGOXoP+UzrX1QP5YDBIDmgiu4hr1FyM/BObM8/uahR2p BoiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:ironport-sdr:dkim-signature; bh=QMwZM+ILUUDeRxao/tmdLuFUCWh7gHxQSp2iEX0iQuc=; b=GoOJL/uRRJ2cRemhSGh1hJOmRnxSB3vfZhnC54uS1riijHQ+kDsNMFZZ5MKqr2h5ZT CR7Is+sYOeiaiGkg5nZ8W+qmxMAiJj5izzIOJz70Nk7PEnTqNk3KgHOKU7dTnqxJnBD7 Kna+qrPWZMR5BjJf14jFoAEhlicboeFJKIUvkwy/kAz1MoLoe9rz5hqrBF8pDY/VvOyP YIYw8W2+BXXwsRhuDwGWAiR/X5dg4hG/lDx/K0rxM0Ad9IPqhuo5He5gGtCOQAvnz4c7 24GAEXQx1FkgnFMPPRIB6jUEoEY4c1as1gNDb/KGwSOAHG5Y+R6WZ+CFppISJf60eAik TtCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@citrix.com header.s=securemail header.b="BRR/oVK+"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 104si3288346otj.252.2020.03.05.04.43.35; Thu, 05 Mar 2020 04:43:47 -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; dkim=fail header.i=@citrix.com header.s=securemail header.b="BRR/oVK+"; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=citrix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726867AbgCEMnR (ORCPT + 99 others); Thu, 5 Mar 2020 07:43:17 -0500 Received: from esa6.hc3370-68.iphmx.com ([216.71.155.175]:37547 "EHLO esa6.hc3370-68.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbgCEMnQ (ORCPT ); Thu, 5 Mar 2020 07:43:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1583412195; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=wATOkHyHfw1nttogMmLbBkJtCs3d5j9hHSTAkJY4KmE=; b=BRR/oVK+Ltl2W4wq7qyebZWggBTMUx92tLo6DwpaRDe8a7dpSZmP6xwN VRdv6L+m8+7o+qt7yhzQ7hVkyD/QVDtsDWpVhVvh+8qBe3Ew9RNBkckrX eYGhfpaBePvoVJP+JcgX+b9D+FBlYyjqVruA/aM1oNmK9spWAjv8JTfbl c=; Authentication-Results: esa6.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa6.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa6.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa6.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: iR1cwtc6wIxZHy2095D3SobXiBpJi1pHjnR4cTvwIX4HwAo3C1DNnED/QdKE4qoxNmS2nAl6jV dbJIfWoZdXEkP183BBYzQ6TbB8GAIJFJsQHT5i05dmAWRfPp9TMq78jYy6zAhB5tY8PZ+Q7C35 eA/Mk5kAW7Vl1HUChfFa3m08+pqPatmh5F6H00J2FJ3RrXlA6MT4yoduIrrON+HcCXhgi/Wx1X VozdPrV+m5W8VHG95mKIH53r6u455YK/zwGOBAEcLqVjoFxNkKJ+9EpJ1DfbZb+f6uwBMlnkjs NjI= X-SBRS: 2.7 X-MesageID: 13885325 X-Ironport-Server: esa6.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.70,518,1574139600"; d="scan'208";a="13885325" Date: Thu, 5 Mar 2020 13:42:55 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Juergen Gross CC: , , , Boris Ostrovsky , Stefano Stabellini , Konrad Rzeszutek Wilk , Jens Axboe Subject: Re: [PATCH v2] xen/blkfront: fix ring info addressing Message-ID: <20200305124255.GW24458@Air-de-Roger.citrite.net> References: <20200305114044.20235-1-jgross@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200305114044.20235-1-jgross@suse.com> X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL01.citrite.net (10.69.22.125) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Also, info should be constified AFAICT. With at least info constified: Acked-by: Roger Pau Monné Can you queue this through the Xen tree? Thanks, Roger.