From patchwork Fri May 10 14:12:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10938923 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2367B92A for ; Fri, 10 May 2019 14:14:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1290228803 for ; Fri, 10 May 2019 14:14:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 06A8A28C16; Fri, 10 May 2019 14:14:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id AA2B928803 for ; Fri, 10 May 2019 14:14:47 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hP6Gi-00014G-2F; Fri, 10 May 2019 14:13:00 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hP6Gg-00014B-Lw for xen-devel@lists.xenproject.org; Fri, 10 May 2019 14:12:58 +0000 X-Inumbo-ID: b56fac4b-732d-11e9-8980-bc764e045a96 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id b56fac4b-732d-11e9-8980-bc764e045a96; Fri, 10 May 2019 14:12:57 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Fri, 10 May 2019 08:12:56 -0600 Message-Id: <5CD586E3020000780022D9D1@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Fri, 10 May 2019 08:12:51 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH] x86/mm: free_page_type() is PV-only 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: Wei Liu , George Dunlap , Andrew Cooper , Tim Deegan , Julien Grall , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP While it already has a CONFIG_PV wrapped around its entire body, it is still uselessly invoking mfn_to_gmfn(), which is about to be replaced. Avoid morphing this code into even more suspicious shape and remove the effectively dead code - translated mode has been made impossible for PV quite some time ago. Adjust and extend the assertions at the same time: The original ASSERT(!shadow_mode_refcounts(owner)) really means ASSERT(!shadow_mode_enabled(owner) || !paging_mode_refcounts(owner)), which isn't what we want here. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper Reviewed-by: Wei Liu Reviewed-by: George Dunlap --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -2632,7 +2632,6 @@ int free_page_type(struct page_info *pag { #ifdef CONFIG_PV struct domain *owner = page_get_owner(page); - unsigned long gmfn; int rc; if ( likely(owner != NULL) && unlikely(paging_mode_enabled(owner)) ) @@ -2640,11 +2639,11 @@ int free_page_type(struct page_info *pag /* A page table is dirtied when its type count becomes zero. */ paging_mark_dirty(owner, page_to_mfn(page)); - ASSERT(!shadow_mode_refcounts(owner)); + ASSERT(shadow_mode_enabled(owner)); + ASSERT(!paging_mode_refcounts(owner)); + ASSERT(!paging_mode_translate(owner)); - gmfn = mfn_to_gmfn(owner, mfn_x(page_to_mfn(page))); - if ( VALID_M2P(gmfn) ) - shadow_remove_all_shadows(owner, _mfn(gmfn)); + shadow_remove_all_shadows(owner, page_to_mfn(page)); } if ( !(type & PGT_partial) )