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=-12.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham 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 8D3F4C433E0 for ; Mon, 11 Jan 2021 13:52:07 +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 5138622283 for ; Mon, 11 Jan 2021 13:52:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5138622283 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 list by lists.xenproject.org with outflank-mailman.64862.114684 (Exim 4.92) (envelope-from ) id 1kyxbx-0002UU-KG; Mon, 11 Jan 2021 13:51:57 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 64862.114684; Mon, 11 Jan 2021 13:51:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kyxbx-0002UN-GJ; Mon, 11 Jan 2021 13:51:57 +0000 Received: by outflank-mailman (input) for mailman id 64862; Mon, 11 Jan 2021 13:51:55 +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.92) (envelope-from ) id 1kyxbv-0002UF-De for xen-devel@lists.xenproject.org; Mon, 11 Jan 2021 13:51:55 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 44831a7c-bb63-4c0e-a857-de2a9a7e4b38; Mon, 11 Jan 2021 13:51:54 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 44831a7c-bb63-4c0e-a857-de2a9a7e4b38 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1610373114; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=HAcV3pYDeQumGZkHBAwCTK57xhRyJmySWgKKlDPRnHk=; b=LyFuE/vsld87GICCYY9FJcOdoZNFPUccMwtN5dFXftZQmrClrbtLxwE0 tBuq6mN+g6d2tcdMqTo14Kn5a1w8uf/wIpugbSpXcu9/l/pAgghqS5SjX umedRGEswQP0OKX4GpBWUU8RthmzaptQB4MsvPzxgqAd1c8C/nsK6S12M 4=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: Pbnybj48aW/KHLPzOZqhAUWjPfLt6eZwSSzSVzgcoTDkCD6Yfr4wJlMflMoHnFcrIfdQHuZdz0 dEsF658fALDFTUbazOFa35WmGTj7+oQHwGIkaV9TUzOb5FNtmBFaBo0MGwqerDVOrLxFzfJshY FwcskRh5uXOIhMgjASpuTZnpcx6trEw3c+FLH+SrNnt9tGvwvJdqC87cgtI27G+WcBYytC/osU WQU2NT6+NIfvEzcDG9nsYPQSkRg1rOCtYYvDp+mT34GKXL0pV81cXLpcN+yZqp01dlzF5I3k3r RQI= X-SBRS: 5.2 X-MesageID: 35192170 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.79,338,1602561600"; d="scan'208";a="35192170" Subject: Re: [PATCH v2 09/11] xen/memory: Fix mapping grant tables with XENMEM_acquire_resource To: , 'Xen-devel' CC: 'George Dunlap' , 'Ian Jackson' , 'Jan Beulich' , 'Stefano Stabellini' , 'Wei Liu' , 'Julien Grall' , =?UTF-8?B?J01pY2hhxYIgTGVzemN6ecWEc2tpJw==?= , 'Hubert Jasudowicz' , 'Tamas K Lengyel' References: <20200922182444.12350-1-andrew.cooper3@citrix.com> <20200922182444.12350-10-andrew.cooper3@citrix.com> <007a01d69260$248a2fc0$6d9e8f40$@xen.org> From: Andrew Cooper Message-ID: <320c7ac7-aa89-71e0-8ff4-f95be04fa242@citrix.com> Date: Fri, 8 Jan 2021 19:36:02 +0000 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: <007a01d69260$248a2fc0$6d9e8f40$@xen.org> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Content-Language: en-GB X-ClientProxiedBy: FTLPEX02CAS01.citrite.net (10.13.99.120) To FTLPEX02CL03.citrite.net (10.13.108.165) On 24/09/2020 11:47, Paul Durrant wrote: >> diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c >> index e82307bdae..8628f51402 100644 >> --- a/xen/arch/x86/mm.c >> +++ b/xen/arch/x86/mm.c >> @@ -4632,7 +4632,6 @@ int arch_acquire_resource(struct domain *d, unsigned int type, >> if ( id != (unsigned int)ioservid ) >> break; >> >> - rc = 0; >> for ( i = 0; i < nr_frames; i++ ) >> { >> mfn_t mfn; >> @@ -4643,6 +4642,9 @@ int arch_acquire_resource(struct domain *d, unsigned int type, >> >> mfn_list[i] = mfn_x(mfn); >> } >> + if ( i == nr_frames ) >> + /* Success. Passed nr_frames back to the caller. */ > Nit: s/passed/pass That would change the meaning of the comment, and it would no longer be accurate. > >> + rc = nr_frames; >> break; >> } >> #endif >> diff --git a/xen/common/compat/memory.c b/xen/common/compat/memory.c >> index 834c5e19d1..17619f26ed 100644 >> --- a/xen/common/compat/memory.c >> +++ b/xen/common/compat/memory.c >> @@ -611,6 +622,21 @@ int compat_memory_op(unsigned int cmd, XEN_GUEST_HANDLE_PARAM(void) compat) >> break; >> } >> >> + if ( split < 0 ) >> + { >> + /* Contintuation occured. */ >> + ASSERT(rc != XENMEM_acquire_resource); > Do you mean "op !=" here? No.  Such an assertion had better trigger every time we hit this path. rc is the continuation information that we're in the middle of processing.  See also the comment about this being a giant undebuggable mess. ~Andrew