From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF34DC3815B for ; Mon, 20 Apr 2020 09:17:10 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BF1F72078E for ; Mon, 20 Apr 2020 09:17:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BF1F72078E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jQSXs-00028x-AZ; Mon, 20 Apr 2020 09:16:52 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jQSXq-00028s-Ok for xen-devel@lists.xenproject.org; Mon, 20 Apr 2020 09:16:50 +0000 X-Inumbo-ID: a992cc3c-82e7-11ea-903e-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id a992cc3c-82e7-11ea-903e-12813bfff9fa; Mon, 20 Apr 2020 09:16:48 +0000 (UTC) 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 C449EAD2A; Mon, 20 Apr 2020 09:16:46 +0000 (UTC) Subject: Re: [PATCH 05/17] xen/x86: Remove the non-typesafe version of pagetable_* helpers To: Julien Grall References: <20200322161418.31606-1-julien@xen.org> <20200322161418.31606-6-julien@xen.org> <2be87441-05a6-6b58-23e3-da467230ffe7@xen.org> From: Jan Beulich Message-ID: <6af445d8-636f-a19e-ac53-9c66ae9f61c5@suse.com> Date: Mon, 20 Apr 2020 11:16:41 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Wei Liu , Andrew Cooper , Julien Grall , Tim Deegan , George Dunlap , Jun Nakajima , xen-devel@lists.xenproject.org, =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 18.04.2020 12:23, Julien Grall wrote: > On 30/03/2020 08:52, Jan Beulich wrote: >> On 28.03.2020 11:52, Julien Grall wrote: >>> On 26/03/2020 15:39, Jan Beulich wrote: >>>> On 22.03.2020 17:14, julien@xen.org wrote: >>>>> @@ -3116,24 +3116,24 @@ int vcpu_destroy_pagetables(struct vcpu *v) >>>>>          /* Free that page if non-zero */ >>>>>        do { >>>>> -        if ( mfn ) >>>>> +        if ( !mfn_eq(mfn, _mfn(0)) ) >>>> >>>> I admit I'm not fully certain either, but at the first glance >>>> >>>>           if ( mfn_x(mfn) ) >>>> >>>> would seem more in line with the original code to me (and then >>>> also elsewhere). >>> >>> It is doing *exactly* the same things. The whole point of typesafe >>> is to use typesafe helper not open-coding test everywhere. >>> >>> It is also easier to spot any use of MFN 0 within the code as you >>> know could grep "_mfn(0)". >>> >>> Therefore I will insist to the code as-is. >> >> What I insit on is that readability of the result of such changes be >> also kept in mind. The mfn_eq() construct is (I think) clearly less >> easy to read and recognize than the simpler alternative suggested. > > If mfn_eq() is less clear, then where do you draw the line when the > macro should or not be used? I'm afraid there may not be a clear line to draw until everything got converted. I do seem to recall though that, perhaps in a different context, Andrew recently agreed with my view here (Andrew, please correct me if I'm wrong). It being a fuzzy thing, I guess maintainers get to judge ... Jan