From patchwork Wed Jan 8 17:24:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11324191 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7525D109A for ; Wed, 8 Jan 2020 17:25:13 +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 51583205F4 for ; Wed, 8 Jan 2020 17:25:13 +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="PwwkJDvz" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51583205F4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none 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 1ipF4M-0003HP-8O; Wed, 08 Jan 2020 17:24:34 +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 1ipF4K-0003HG-T3 for xen-devel@lists.xenproject.org; Wed, 08 Jan 2020 17:24:32 +0000 X-Inumbo-ID: bb5387d8-323b-11ea-b861-12813bfff9fa Received: from esa5.hc3370-68.iphmx.com (unknown [216.71.155.168]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id bb5387d8-323b-11ea-b861-12813bfff9fa; Wed, 08 Jan 2020 17:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1578504271; h=from:to:cc:subject:date:message-id:mime-version; bh=HODhukAblgEi0KXLUXq3HGsv6ZoaQdq52eo34hySp9w=; b=PwwkJDvzsvvKUxMpRnZXaqo6Y5UVH8ET+ZrLdckD0moa65tX3VVBjOmg 4l3P37Fm53bwQiZU3p0ZR8ScQthzA5WJ4AD9M0QEub1n2QaKJ/bl+YkaU l0iXhjqjPzzT4cNL5DjFfNRdYqGSNhwg8DHlqSNZXhmkjLHhvhAlV+Bwl U=; Authentication-Results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa5.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa5.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa5.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: ysDd3iCRJ/zspTRASs9biTVVpV+E0ZxAMGIG7HZvr/Lk58GSXcjZJxZEnP7Q9945zK4gXwbeRi EJp+hNV5Wpq66eKft0040D3VyJJkgPGOKaCRZYXaj448MyQZLucsvkfkIgZWWUCNjrXeBAIpyV Jm4q5nuVrigRQQN5V9iiVMtP0dLciyHQ7l8UiXZImOYz0J3qAACKLSAyvB+EhuvPJMFLvWoLPC o7omIXwLXT2rXTYLHl9GwVYjlJ2A0f+O4klz/bJyVGinIZrAACVwGSzvS+qaQAW45YJkbWU0aK /KU= X-SBRS: 2.7 X-MesageID: 11012568 X-Ironport-Server: esa5.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.69,410,1571716800"; d="scan'208";a="11012568" From: Andrew Cooper To: Xen-devel Date: Wed, 8 Jan 2020 17:24:28 +0000 Message-ID: <20200108172428.28672-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2] x86/mem_sharing: Fix RANDCONFIG build 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: Andrew Cooper , Tamas K Lengyel Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Travis reports: https://travis-ci.org/andyhhp/xen/jobs/633751811 mem_sharing.c:361:13: error: 'rmap_has_entries' defined but not used [-Werror=unused-function] static bool rmap_has_entries(const struct page_info *page) ^ cc1: all warnings being treated as errors This happens in a release build (disables MEM_SHARING_AUDIT) when CONFIG_MEM_SHARING is enabled. Expand both trivial helpers into their single callsite. Signed-off-by: Andrew Cooper Acked-by: Tamas K Lengyel --- CC: Tamas K Lengyel v2: * Expand, rather than mark as __maybe_unused --- xen/arch/x86/mm/mem_sharing.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index ddf1f0f9f9..64dd3689df 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -351,18 +351,6 @@ static gfn_info_t *rmap_retrieve(uint16_t domain_id, unsigned long gfn, return NULL; } -/* Returns true if the rmap has only one entry. O(1) complexity. */ -static bool rmap_has_one_entry(const struct page_info *page) -{ - return rmap_count(page) == 1; -} - -/* Returns true if the rmap has any entries. O(1) complexity. */ -static bool rmap_has_entries(const struct page_info *page) -{ - return rmap_count(page) != 0; -} - /* * The iterator hides the details of how the rmap is implemented. This * involves splitting the list_for_each_safe macro into two steps. @@ -531,7 +519,7 @@ static int audit(void) } /* Check we have a list */ - if ( (!pg->sharing) || !rmap_has_entries(pg) ) + if ( (!pg->sharing) || rmap_count(pg) == 0 ) { MEM_SHARING_DEBUG("mfn %lx shared, but empty gfn list!\n", mfn_x(mfn)); @@ -1220,7 +1208,7 @@ int __mem_sharing_unshare_page(struct domain *d, * Do the accounting first. If anything fails below, we have bigger * bigger fish to fry. First, remove the gfn from the list. */ - last_gfn = rmap_has_one_entry(page); + last_gfn = rmap_count(page) == 1; if ( last_gfn ) { /*