Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5183610imm; Wed, 12 Sep 2018 02:17:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaIW/5hfoob30d0pIlNSumoikLFk0H2viQpJY8z57o3hDrn1GaNn8L4nPcuS8PfWYi0u333 X-Received: by 2002:a63:6054:: with SMTP id u81-v6mr1088388pgb.433.1536743851322; Wed, 12 Sep 2018 02:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536743851; cv=none; d=google.com; s=arc-20160816; b=ZeYd7S5pzGwqET8gv1IJ2Bqy7oUy6HzeqaqFSNf+tKzy5BwPyEBXJbLUpKI4WvYV1K +dOFXc1NVsm86/mfyskmQ5e8bns/Y2Ij+48JhfCLEvZ4Oijb5z4EXq8Xw8gv5t4ZTzdl lqs5TEZY+zRwGO/rm+oVY9wLDHR4tsPk6SHQ0SAtQHOQmzMlNq4atd2T4RTcN3uermGk fWpHoBudPU25co4m3lzpJ8OrZfSwWm0hhLqTL77bLYJ4EJMkkgTyKd9xSoPflqqaHNrl +Sw7u4fUf+CW7mvCeadMgOaYGAF+OgVRm4Y3D7RBPlmFM/JLxXREgcg+2GHMZ05zfVJK UbmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=G1UZ5AgbfY+wV8wdK2jy1C0fF24+U9VRd3FrmDoBpoc=; b=YfeQzwkPLO0GO4gWBgH8U9gqpN7AsvugusAPVDvlr4brfYOl5QlQ+fj0tl9ubWNYlJ IbOUSQtzswJOD7QCb7dpYjVDDLzTsi7mTA9B/Bk72Qbo9CTs7yf7O6AHxXYAl5e3oQYk 8bo0C1SQLQ4SoUgE80Fmzn3XnWIBEvhJqP6AWvcEgaCOR0NlUcCGgVXTCVtwUg5WllLi wnDs6msyJQBPn0MzUmeuqfm8oGlNvXPNn8rcEL/2PlE5oAZGaj7hPqpXvW4i8/gC+Dnr pHU0AwMSc+C7ZNxVGfkGsyibFxESQOs1YQWEQVez/LEhssXQkw0YZ2WlWaNJS6bCX8NX LGYA== 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 x69-v6si581954pgd.49.2018.09.12.02.17.16; Wed, 12 Sep 2018 02:17:31 -0700 (PDT) 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 S1727675AbeILOUa (ORCPT + 99 others); Wed, 12 Sep 2018 10:20:30 -0400 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:2317 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726555AbeILOUa (ORCPT ); Wed, 12 Sep 2018 10:20:30 -0400 X-IronPort-AV: E=Sophos;i="5.53,364,1531785600"; d="scan'208";a="78924982" Date: Wed, 12 Sep 2018 11:16:39 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Julien Grall CC: Jan Beulich , Jens Axboe , Konrad Rzeszutek Wilk , , , xen-devel , zhong jiang Subject: Re: [Xen-devel] [PATCH] drivers/block/xen-blkback/common.h: use DIV_ROUND_UP instead of reimplementing its function Message-ID: <20180912091639.oynlvdo6pghnqfvt@mac.bytemobile.com> References: <1536731100-56054-1-git-send-email-zhongjiang@huawei.com> <5B98CAE202000078001E79CC@prv1-mh.provo.novell.com> <20180912091350.6wuvt2jkvzg6wruo@mac.bytemobile.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180912091350.6wuvt2jkvzg6wruo@mac.bytemobile.com> User-Agent: NeoMutt/20180716 X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry, I've failed to add Julien in my previous reply. On Wed, Sep 12, 2018 at 11:13:50AM +0200, Roger Pau Monn? wrote: > Adding Julien how did the work to support XEN_PAGE_SIZE != PAGE_SIZE. > > On Wed, Sep 12, 2018 at 02:14:26AM -0600, Jan Beulich wrote: > > >>> On 12.09.18 at 07:45, wrote: > > > --- a/drivers/block/xen-blkback/common.h > > > +++ b/drivers/block/xen-blkback/common.h > > > @@ -65,7 +65,7 @@ > > > (XEN_PAGES_PER_INDIRECT_FRAME / XEN_PAGES_PER_SEGMENT) > > > > > > #define MAX_INDIRECT_PAGES \ > > > - ((MAX_INDIRECT_SEGMENTS + SEGS_PER_INDIRECT_FRAME - 1)/SEGS_PER_INDIRECT_FRAME) > > > + DIV_ROUND_UP(MAX_INDIRECT_SEGMENTS, SEGS_PER_INDIRECT_FRAME) > > > #define INDIRECT_PAGES(_segs) DIV_ROUND_UP(_segs, XEN_PAGES_PER_INDIRECT_FRAME) > > > > My first reaction was to suggest > > > > #define MAX_INDIRECT_PAGES INDIRECT_PAGES(MAX_INDIRECT_SEGMENTS) > > > > but that wouldn't match what's there currently (note the two different > > divisors). I can't really decide whether that's just unfortunate naming > > of the two macros, or an actual bug. > > I think there's indeed a bug here. > > AFAICT, MAX_INDIRECT_PAGES should use XEN_PAGES_PER_INDIRECT_FRAME and > then it could be changed as Jan suggested. > > Current MAX_INDIRECT_PAGES is misnamed and should instead be > MAX_INDIRECT_SEGS (which on x86 is exactly the same because PAGE_SIZE > == XEN_PAGE_SIZE). > > Roger. > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xenproject.org > https://lists.xenproject.org/mailman/listinfo/xen-devel