Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp5829028ybf; Thu, 5 Mar 2020 07:48:04 -0800 (PST) X-Google-Smtp-Source: ADFU+vuoMNOSvZlba2IA7J6TgDsE/4EH1YZ73I4pB0V1ApaLv4wuU8QYTt8hxViYAR9pd6akL17s X-Received: by 2002:aca:cd85:: with SMTP id d127mr2724978oig.14.1583423284472; Thu, 05 Mar 2020 07:48:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583423284; cv=none; d=google.com; s=arc-20160816; b=NbsSkzeoO861bfxzys2T922oCx1KJfYiNnNWUXymNF4Qg5tOlOQ3aMqsvxPgmA0lWn POfJ+wwXRcu4B0VGPZOfuFUxROPPUWnCo4qX2Fj6vHBYheiQln+Pqs+OaU337sTuA1pJ n/J9p2UNV401zvr41Dgey/w2VEnJuoVTJz67fH0FZXt2y0s/UpGsIfI12zK54OE+xHkJ 8oJIDRhdOBn25Zo2aG9p7run41K3cp11wwANOVIic3vEvL2hrqVZBvXqoZSmt9R4ZYe/ 3pZyforwaDWjzS3es8io41b9b2wO+7qV0P4ooTNPSTC22X5puiNE/me25a8IvZYRycth doig== 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:dkim-signature; bh=7zaRKGsS0ZE69bPjVfBfvoMx3pCqo5nNA7n4fl7ujvw=; b=VecBu3p2ibs3R+Lgqu53LetpsZ5sKVPaGCb0lQbrAzmy40GetbhOeRJAgk5xEyNOxX Cw7GQWOApwVzgZumISTxsueI3fRjxV8J55PB6js3mOXG11xNg8ZK2iD1LplKtMKM+M6k uPHNNAeiCC4m4NSK+PceU6DnEWkCjDsG+54oFSNzhUfvSj84nneHTeQuzoK3M1Frnm6W 9X9sQv4jY4Qf4cK3zJ8y4+Z6e8YNsA0/zhKIcGQ3fx63njjHL1P/mW1e6LA+33wuWb2E dJqo0+4b95c2k2FZuGpJsrUIWEWb6UCeVksrvuLKG1O+orKL7eofXFh9NrRGirQ+sgPc vkQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@eikelenboom.it header.s=20180706 header.b=Jz13duDq; 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=eikelenboom.it Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a19si1715839oid.254.2020.03.05.07.47.52; Thu, 05 Mar 2020 07:48:04 -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=@eikelenboom.it header.s=20180706 header.b=Jz13duDq; 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=eikelenboom.it Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726957AbgCEPrJ (ORCPT + 99 others); Thu, 5 Mar 2020 10:47:09 -0500 Received: from server.eikelenboom.it ([91.121.65.215]:56692 "EHLO server.eikelenboom.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726067AbgCEPrI (ORCPT ); Thu, 5 Mar 2020 10:47:08 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=eikelenboom.it; s=20180706; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7zaRKGsS0ZE69bPjVfBfvoMx3pCqo5nNA7n4fl7ujvw=; b=Jz13duDqLs43Wm1XWWqVFYDdVi uowHRKPtI85xiEhqC1CHiWIVqwu5o8osd2w3ocR/lktYKldMi/jWfzSYsehwW7zq6dHMTyWbdu9of OcmlvvPoZNMZ8i2Bb0effUlmmp2LE+ytNWqNMJMjKcWcOxVSE0totMaCx8pF35QZpVMA=; Received: from ip4da85049.direct-adsl.nl ([77.168.80.73]:54264 helo=[172.16.1.50]) by server.eikelenboom.it with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j9skC-0005zf-Kp; Thu, 05 Mar 2020 16:49:04 +0100 Subject: Re: [Xen-devel] [PATCH v2] xen/blkfront: fix ring info addressing To: =?UTF-8?B?SsO8cmdlbiBHcm/Dnw==?= , =?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: Sander Eikelenboom Message-ID: <68f09f4e-180f-0fb7-c329-f3f03be72eb6@eikelenboom.it> Date: Thu, 5 Mar 2020 16:47:01 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 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/2020 14:40, Jürgen Groß wrote: > 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 > Just tested v2 and it works for me, thanks ! -- Sander