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=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, 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 AFDBAC4363D for ; Tue, 22 Sep 2020 14:51:08 +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 5D8B1208A9 for ; Tue, 22 Sep 2020 14:51:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="Wcnb6j4v" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5D8B1208A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.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.92) (envelope-from ) id 1kKjd5-0000qF-1e; Tue, 22 Sep 2020 14:50:51 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kKjd4-0000q8-Bv for xen-devel@lists.xenproject.org; Tue, 22 Sep 2020 14:50:50 +0000 X-Inumbo-ID: 2466ed7a-6e82-4074-9864-03750f8af535 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2466ed7a-6e82-4074-9864-03750f8af535; Tue, 22 Sep 2020 14:50:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1600786249; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=6Ioy9Ra/XLzAsqG3hkver3Ci23Ywj7OWBmmup69R7Uw=; b=Wcnb6j4vfbnHYH3CG/UqEd1oPGHBdQAe4bRDj8zp7NhL9wHP/J+7LfmT yxFrlPKCwIWeVIwX9IaoJVUJNwoMSir+tgKJYIDCGm9/e1gxCrpvuu7kK OH0du62cv3lEdIqsQROXKx5EBL+bf3w/HbwfsbEb6Aq79VNTsuDoukfOL c=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 8/H5LiJ5BtRy5HSw83VijRj5rO0lDHJ4O1dWOJlPYkE6XqLNoEB7WDclCN9OD7Z9CMV6B5IScu XMKLvwILjSZj9L5hFJfFsmBt4jCcboK28JGf9SWJuI0wpCoNHBKa7xaJMELFFBR2ryyLsXV/zj nd839N9qe99BzWMqWnAjzua6tlqY4RKcdORDHSuxe1EoLUslUAR0sR0uJS1FRi5MklOjqHa1tt WHINioeh8FDP5pomVOWmcLMwJ1SfGTr94S5FC00WVAOY22Rs93UANt4rTupokkJjx85ZtnkFPs w0M= X-SBRS: 2.7 X-MesageID: 27601873 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.77,291,1596513600"; d="scan'208";a="27601873" Subject: Re: [PATCH 2/5] xen/gnttab: Rework resource acquisition To: Jan Beulich CC: Xen-devel , George Dunlap , Ian Jackson , "Konrad Rzeszutek Wilk" , Stefano Stabellini , Wei Liu , Julien Grall , Paul Durrant , =?UTF-8?Q?Micha=c5=82_Leszczy=c5=84ski?= , "Hubert Jasudowicz" References: <20200728113712.22966-1-andrew.cooper3@citrix.com> <20200728113712.22966-3-andrew.cooper3@citrix.com> <784bf5c1-be13-2c09-5494-6eb64c400473@suse.com> <17123e43-ca3e-4075-ad36-45e324bb6214@citrix.com> From: Andrew Cooper Message-ID: Date: Tue, 22 Sep 2020 15:50:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Language: en-GB X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To FTLPEX02CL05.citrite.net (10.13.108.178) X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 22/09/2020 14:34, Jan Beulich wrote: > On 22.09.2020 15:10, Andrew Cooper wrote: >> On 29/07/2020 21:02, Jan Beulich wrote: >>> On 28.07.2020 13:37, Andrew Cooper wrote: >>>> --- a/xen/common/grant_table.c >>>> +++ b/xen/common/grant_table.c >>>> @@ -4013,6 +4013,72 @@ static int gnttab_get_shared_frame_mfn(struct >>>> domain *d, >>>>       return 0; >>>>   } >>>>   +int gnttab_acquire_resource( >>>> +    struct domain *d, unsigned int id, unsigned long frame, >>>> +    unsigned int nr_frames, xen_pfn_t mfn_list[]) >>>> +{ >>>> +    struct grant_table *gt = d->grant_table; >>>> +    unsigned int i = nr_frames, tot_frames; >>>> +    void **vaddrs; >>>> +    int rc = 0; >>>> + >>>> +    /* Input sanity. */ >>>> +    if ( !nr_frames ) >>>> +        return -EINVAL; >>> I can't seem to be able to find an equivalent of this in the old logic, >>> and hence this looks like an unwarranted change in behavior to me. We >>> have quite a few hypercall ops where some count being zero is simply >>> a no-op, i.e. yielding success without doing anything. >> There is no possible circumstance when getting here requesting 0 is >> legitimate. >> >> Tolerating a zero input for a mapping request is a very expensive way of >> hiding caller bugs. > That's just one possible view. ... that is fully enforced in the ecosystem we work in. You can't get a 0 to here in the first place. However, when it comes to the XLAT and the chunking fixes, getting 0 here is a hard error, and I'm not interested in breaking the that logic for a non-existent corner case. ~Andrew