From nobody Mon Feb 9 20:21:11 2026 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1579629091; cv=none; d=zohomail.com; s=zohoarc; b=hkFL2bwsK7sErJzGRUKzDqLw6Ksjpk+CERX95UnCAMJU9azBm54nPGIr8Fk7tf8GQOfATq5vADlEDuKVB9GFeaIU/Mf0im6oxGH+UA9+sU4rsyuN8qp1AjCDgju9Lsys9jTIaOYW5/MihnF1tPefm6jT+eQeieZEZar8l5XluL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579629091; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ibm2Ky7IWi508nDwYqulZiph5EduDJV3AgnFwJn62gA=; b=VOUG4Wv0ZTumxj6gK12B6FeOlBbuBYvFE35tgZ7fqZjdJLgPLBDvJph/m43cugZuFcD9XPb8b+S0HM7bKm5K3IU1r17Bxv72y5SnhfEvZ2JFiuvpGZPpC12bzBDF5y0drgRWgHqPP+8beF+k/TmxLikq53m/jMsSkpdLOniokjY= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1579629091428745.087816698641; Tue, 21 Jan 2020 09:51:31 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1itxfy-000586-Ps; Tue, 21 Jan 2020 17:50:54 +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 1itxfx-00056h-Bk for xen-devel@lists.xenproject.org; Tue, 21 Jan 2020 17:50:53 +0000 Received: from mga04.intel.com (unknown [192.55.52.120]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 7ae41102-3c76-11ea-bb21-12813bfff9fa; Tue, 21 Jan 2020 17:50:17 +0000 (UTC) Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jan 2020 09:50:06 -0800 Received: from tlengyel-mobl2.amr.corp.intel.com (HELO localhost.localdomain) ([10.251.23.127]) by orsmga006.jf.intel.com with ESMTP; 21 Jan 2020 09:50:05 -0800 X-Inumbo-ID: 7ae41102-3c76-11ea-bb21-12813bfff9fa X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,346,1574150400"; d="scan'208";a="228929198" From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Tue, 21 Jan 2020 09:49:44 -0800 Message-Id: X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v5 11/18] x86/mem_sharing: Replace MEM_SHARING_DEBUG with gdprintk 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: Tamas K Lengyel , Tamas K Lengyel , Wei Liu , George Dunlap , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Using XENLOG_ERR level since this is only used in debug paths (ie. it's expected the user already has loglvl=3Dall set). Also use %pd to print the = domain ids. Signed-off-by: Tamas K Lengyel --- xen/arch/x86/mm/mem_sharing.c | 82 +++++++++++++++++------------------ 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index da7d142ad8..21ce8d32f3 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -49,9 +49,6 @@ typedef struct pg_lock_data { =20 static DEFINE_PER_CPU(pg_lock_data_t, __pld); =20 -#define MEM_SHARING_DEBUG(_f, _a...) \ - debugtrace_printk("mem_sharing_debug: %s(): " _f, __func__, ##_a) - /* Reverse map defines */ #define RMAP_HASHTAB_ORDER 0 #define RMAP_HASHTAB_SIZE \ @@ -482,9 +479,9 @@ static int audit(void) /* If we can't lock it, it's definitely not a shared page */ if ( !mem_sharing_page_lock(pg) ) { - MEM_SHARING_DEBUG( - "mfn %lx in audit list, but cannot be locked (%lx)!\n", - mfn_x(mfn), pg->u.inuse.type_info); + gdprintk(XENLOG_ERR, + "mfn %lx in audit list, but cannot be locked (%lx)!\n= ", + mfn_x(mfn), pg->u.inuse.type_info); errors++; continue; } @@ -492,9 +489,9 @@ static int audit(void) /* Check if the MFN has correct type, owner and handle. */ if ( (pg->u.inuse.type_info & PGT_type_mask) !=3D PGT_shared_page ) { - MEM_SHARING_DEBUG( - "mfn %lx in audit list, but not PGT_shared_page (%lx)!\n", - mfn_x(mfn), pg->u.inuse.type_info & PGT_type_mask); + gdprintk(XENLOG_ERR, + "mfn %lx in audit list, but not PGT_shared_page (%lx)= !\n", + mfn_x(mfn), pg->u.inuse.type_info & PGT_type_mask); errors++; continue; } @@ -502,24 +499,24 @@ static int audit(void) /* Check the page owner. */ if ( page_get_owner(pg) !=3D dom_cow ) { - MEM_SHARING_DEBUG("mfn %lx shared, but wrong owner %pd!\n", - mfn_x(mfn), page_get_owner(pg)); + gdprintk(XENLOG_ERR, "mfn %lx shared, but wrong owner (%pd)!\n= ", + mfn_x(mfn), page_get_owner(pg)); errors++; } =20 /* Check the m2p entry */ if ( !SHARED_M2P(get_gpfn_from_mfn(mfn_x(mfn))) ) { - MEM_SHARING_DEBUG("mfn %lx shared, but wrong m2p entry (%lx)!\= n", - mfn_x(mfn), get_gpfn_from_mfn(mfn_x(mfn))); + gdprintk(XENLOG_ERR, "mfn %lx shared, but wrong m2p entry (%lx= )!\n", + mfn_x(mfn), get_gpfn_from_mfn(mfn_x(mfn))); errors++; } =20 /* Check we have a list */ if ( (!pg->sharing) || rmap_count(pg) =3D=3D 0 ) { - MEM_SHARING_DEBUG("mfn %lx shared, but empty gfn list!\n", - mfn_x(mfn)); + gdprintk(XENLOG_ERR, "mfn %lx shared, but empty gfn list!\n", + mfn_x(mfn)); errors++; continue; } @@ -538,24 +535,26 @@ static int audit(void) d =3D get_domain_by_id(g->domain); if ( d =3D=3D NULL ) { - MEM_SHARING_DEBUG("Unknown dom: %hu, for PFN=3D%lx, MFN=3D= %lx\n", - g->domain, g->gfn, mfn_x(mfn)); + gdprintk(XENLOG_ERR, + "Unknown dom: %pd, for PFN=3D%lx, MFN=3D%lx\n", + d, g->gfn, mfn_x(mfn)); errors++; continue; } o_mfn =3D get_gfn_query_unlocked(d, g->gfn, &t); if ( !mfn_eq(o_mfn, mfn) ) { - MEM_SHARING_DEBUG("Incorrect P2M for d=3D%hu, PFN=3D%lx." - "Expecting MFN=3D%lx, got %lx\n", - g->domain, g->gfn, mfn_x(mfn), mfn_x(o_m= fn)); + gdprintk(XENLOG_ERR, "Incorrect P2M for d=3D%pd, PFN=3D%lx= ." + "Expecting MFN=3D%lx, got %lx\n", + d, g->gfn, mfn_x(mfn), mfn_x(o_mfn)); errors++; } if ( t !=3D p2m_ram_shared ) { - MEM_SHARING_DEBUG("Incorrect P2M type for d=3D%hu, PFN=3D%= lx MFN=3D%lx." - "Expecting t=3D%d, got %d\n", - g->domain, g->gfn, mfn_x(mfn), p2m_ram_s= hared, t); + gdprintk(XENLOG_ERR, + "Incorrect P2M type for d=3D%pd, PFN=3D%lx MFN=3D= %lx." + "Expecting t=3D%d, got %d\n", + d, g->gfn, mfn_x(mfn), p2m_ram_shared, t); errors++; } put_domain(d); @@ -564,10 +563,10 @@ static int audit(void) /* The type count has an extra ref because we have locked the page= */ if ( (nr_gfns + 1) !=3D (pg->u.inuse.type_info & PGT_count_mask) ) { - MEM_SHARING_DEBUG("Mismatched counts for MFN=3D%lx." - "nr_gfns in list %lu, in type_info %lx\n", - mfn_x(mfn), nr_gfns, - (pg->u.inuse.type_info & PGT_count_mask)); + gdprintk(XENLOG_ERR, "Mismatched counts for MFN=3D%lx." + "nr_gfns in list %lu, in type_info %lx\n", + mfn_x(mfn), nr_gfns, + (pg->u.inuse.type_info & PGT_count_mask)); errors++; } =20 @@ -578,8 +577,8 @@ static int audit(void) =20 if ( count_found !=3D count_expected ) { - MEM_SHARING_DEBUG("Expected %ld shared mfns, found %ld.", - count_expected, count_found); + gdprintk(XENLOG_ERR, "Expected %ld shared mfns, found %ld.", + count_expected, count_found); errors++; } =20 @@ -757,10 +756,10 @@ static int debug_mfn(mfn_t mfn) return -EINVAL; } =20 - MEM_SHARING_DEBUG( - "Debug page: MFN=3D%lx is ci=3D%lx, ti=3D%lx, owner=3D%pd\n", - mfn_x(page_to_mfn(page)), page->count_info, - page->u.inuse.type_info, page_get_owner(page)); + gdprintk(XENLOG_ERR, + "Debug page: MFN=3D%lx is ci=3D%lx, ti=3D%lx, owner_id=3D%d\n= ", + mfn_x(page_to_mfn(page)), page->count_info, + page->u.inuse.type_info, page_get_owner(page)->domain_id); =20 /* -1 because the page is locked and that's an additional type ref */ num_refs =3D ((int) (page->u.inuse.type_info & PGT_count_mask)) - 1; @@ -776,8 +775,9 @@ static int debug_gfn(struct domain *d, gfn_t gfn) =20 mfn =3D get_gfn_query(d, gfn_x(gfn), &p2mt); =20 - MEM_SHARING_DEBUG("Debug for dom%d, gfn=3D%" PRI_gfn "\n", - d->domain_id, gfn_x(gfn)); + gdprintk(XENLOG_ERR, "Debug for dom%d, gfn=3D%" PRI_gfn "\n", + d->domain_id, gfn_x(gfn)); + num_refs =3D debug_mfn(mfn); put_gfn(d, gfn_x(gfn)); =20 @@ -793,13 +793,13 @@ static int debug_gref(struct domain *d, grant_ref_t r= ef) rc =3D mem_sharing_gref_to_gfn(d->grant_table, ref, &gfn, &status); if ( rc ) { - MEM_SHARING_DEBUG("Asked to debug [dom=3D%d,gref=3D%u]: error %d.\= n", - d->domain_id, ref, rc); + gdprintk(XENLOG_ERR, "Asked to debug [dom=3D%d,gref=3D%u]: error %= d.\n", + d->domain_id, ref, rc); return rc; } =20 - MEM_SHARING_DEBUG("=3D=3D> Grant [dom=3D%d,ref=3D%d], status=3D%x. ", - d->domain_id, ref, status); + gdprintk(XENLOG_ERR, "=3D=3D> Grant [dom=3D%d,ref=3D%d], status=3D%x. = ", + d->domain_id, ref, status); =20 return debug_gfn(d, gfn); } @@ -1274,8 +1274,8 @@ int __mem_sharing_unshare_page(struct domain *d, private_page_found: if ( p2m_change_type_one(d, gfn, p2m_ram_shared, p2m_ram_rw) ) { - gdprintk(XENLOG_ERR, "Could not change p2m type d %hu gfn %lx.\n", - d->domain_id, gfn); + gdprintk(XENLOG_ERR, "Could not change p2m type d %pd gfn %lx.\n", + d, gfn); BUG(); } =20 --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel