From nobody Tue Nov 11 08:31:25 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.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 (zoho.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=1569426661; cv=none; d=zoho.com; s=zohoarc; b=iC5M7pHw7ueerw3il27eNAtRuAw2FsuLSdQpkVUSJrHGu98n6EMzsPfJ4VydE/+nnrUjcBC/qWY9GlgLUn/T/VBURe0sAvYH9O2WiEjpm7j9XRIuy5cu+XkCMPgjNsH9qJOWehrMWGqrth/reiosX+WbqPo+AjtqkqXF4Yv9cK4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1569426661; 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:ARC-Authentication-Results; bh=UEk5f5RrQ64HYBa7gcuVaKdOlFKHlu6JCiy1O1ym4sc=; b=lcE9DUYjdddlfqTCthPeI6vnAPhDo2TnRzCfy20IfTW1EyuDuETuD3kClTbYrFlflKTNCLEKkDcdLppWMrjePg79RZI7DQXjzS2JhXfDsnkS5Jsfpquc/1Xepa5oB2jgEpxFqNkB0RECSaDWZqVx/nO3D1xfkyWNPKt2ygbyROg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=none (zoho.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 1569426661447225.95093040969277; Wed, 25 Sep 2019 08:51:01 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iD9YX-0001xS-Lq; Wed, 25 Sep 2019 15:50:17 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iD9YW-0001wd-Oa for xen-devel@lists.xenproject.org; Wed, 25 Sep 2019 15:50:16 +0000 Received: from mga12.intel.com (unknown [192.55.52.136]) by localhost (Halon) with ESMTPS id 13500822-dfac-11e9-bf31-bc764e2007e4; Wed, 25 Sep 2019 15:49:36 +0000 (UTC) Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Sep 2019 08:49:35 -0700 Received: from tlengyel-mobl2.amr.corp.intel.com (HELO localhost.localdomain) ([10.252.129.153]) by orsmga006.jf.intel.com with ESMTP; 25 Sep 2019 08:49:35 -0700 X-Inumbo-ID: 13500822-dfac-11e9-bf31-bc764e2007e4 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,548,1559545200"; d="scan'208";a="193812682" From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Wed, 25 Sep 2019 08:48:50 -0700 Message-Id: <0312d1c6313d753e5e72050c49fb4aa5c4e05353.1569425745.git.tamas.lengyel@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [RFC PATCH for-next 12/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 , Jan Beulich , =?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). Signed-off-by: Tamas K Lengyel --- xen/arch/x86/mm/mem_sharing.c | 81 ++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index 157a3a1303..a7b9665c8b 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 \ @@ -491,8 +488,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; } @@ -500,8 +498,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_pa= ge (%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; } @@ -509,24 +508,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 (%hu)!\n", - mfn_x(mfn), page_get_owner(pg)->domain_id); + gdprintk(XENLOG_ERR, "mfn %lx shared, but wrong owner (%hu)!\n", + mfn_x(mfn), page_get_owner(pg)->domain_id); 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_has_entries(pg) ) { - 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; } @@ -545,24 +544,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: %hu, for PFN=3D%lx, MFN=3D%lx\n", + g->domain, 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%hu, PFN=3D%lx= ." + "Expecting MFN=3D%lx, got %lx\n", + g->domain, 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%hu, PFN=3D%lx MFN=3D= %lx." + "Expecting t=3D%d, got %d\n", + g->domain, g->gfn, mfn_x(mfn), p2m_ram_shared, t); errors++; } put_domain(d); @@ -571,10 +572,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 @@ -585,8 +586,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 @@ -765,12 +766,12 @@ 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_id=3D%d\n", - mfn_x(page_to_mfn(page)), - page->count_info, - page->u.inuse.type_info, - page_get_owner(page)->domain_id); + 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; @@ -786,8 +787,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 @@ -803,14 +805,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); } --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel