Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5181524imm; Wed, 12 Sep 2018 02:15:24 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaF2CqlVcz020AbRg29aYXgbO0be8A0TAbX/fG4gT0IF/fIJDvjeSL9JurY7G3c6opPTBtz X-Received: by 2002:aa7:84c2:: with SMTP id x2-v6mr1140796pfn.220.1536743724692; Wed, 12 Sep 2018 02:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536743724; cv=none; d=google.com; s=arc-20160816; b=Pg77kSvhN1aiczHKrGNuYfMdf8axDIT6+RmYdGU56zwE/2t15J+P5si/DZxGUwWKQ+ BywCGAACBRRRVMFzo5ggD9zqxYX4E4Q4NUIPBQsLV4tHdHv9u+5mhFFQqvftHffw0Fcf B/vr/reP+Z9mEaMsWrfT9LzW6iZFKf69Xa00GJ60cegnAfop4pzTmLSiiPMzmDP0TqDC nt8agnvrIeeKH5EAIKxVbFf/7ut3JWdPS4217SVDqWmrzIKVcMDYYz2iVYbtMQYDW5eS U/YybXny9LDVmUCzUxbYj+Ptdf5Q85GsEf3FfcioXsBWS+XgVPkvFDTWIl7cbEg5of2S T/Mg== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=AZfKmiST3jAY1BPQ5kj5LmVmnKgnBQoLEnuic8Q/iaM=; b=BlFz0py5QMRMW6buanlem5Lmvq1T6TE+Z3Gp6kTNMvU8FJQXFbORz8TqXsH2rnDtrT HV15raYhm4rE4PjYmq/mIt0Qj8SEn2ZHV7tmRI9wCReHbFWl9hntiCc0pJ8tDb2R9Od2 R9Ua1FFzYm5cXUmgEy033hkdXHqVehm7KMJ1VW9dopV6lgBww8+YRLmcEQaC8reegXLf na2/omqUk7cmCNKOFBqEaJWzcep8TW9bprk7nkF8rJdSxWCQ7CMsCHCV6/JTCh/9JCQ9 zzPlpw5bdNd1JArvd90sb7BITr/zJ5XL4XmyaVnQFUGacCHJ21PidPhihkZHUankYA2+ y/yQ== 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 p123-v6si482344pfg.281.2018.09.12.02.15.08; Wed, 12 Sep 2018 02:15:24 -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 S1728240AbeILORg (ORCPT + 99 others); Wed, 12 Sep 2018 10:17:36 -0400 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:2180 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728211AbeILORf (ORCPT ); Wed, 12 Sep 2018 10:17:35 -0400 X-IronPort-AV: E=Sophos;i="5.53,364,1531785600"; d="scan'208";a="78924783" Date: Wed, 12 Sep 2018 11:13:50 +0200 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Jan Beulich CC: Konrad Rzeszutek Wilk , Jens Axboe , 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: <20180912091350.6wuvt2jkvzg6wruo@mac.bytemobile.com> References: <1536731100-56054-1-git-send-email-zhongjiang@huawei.com> <5B98CAE202000078001E79CC@prv1-mh.provo.novell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <5B98CAE202000078001E79CC@prv1-mh.provo.novell.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 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.