From patchwork Wed Dec 18 19:40:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas K Lengyel X-Patchwork-Id: 11301793 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 79A2C13A4 for ; Wed, 18 Dec 2019 19:42:45 +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 5FBAB206D8 for ; Wed, 18 Dec 2019 19:42:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5FBAB206D8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.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 1ihfCz-0008DL-P1; Wed, 18 Dec 2019 19:42:09 +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 1ihfCy-0008C9-8c for xen-devel@lists.xenproject.org; Wed, 18 Dec 2019 19:42:08 +0000 X-Inumbo-ID: 5d0e22a0-21ce-11ea-90f3-12813bfff9fa Received: from mga03.intel.com (unknown [134.134.136.65]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5d0e22a0-21ce-11ea-90f3-12813bfff9fa; Wed, 18 Dec 2019 19:41:19 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Dec 2019 11:41:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,330,1571727600"; d="scan'208";a="210196354" Received: from tlengyel-mobl2.amr.corp.intel.com (HELO localhost.localdomain) ([10.254.103.7]) by orsmga008.jf.intel.com with ESMTP; 18 Dec 2019 11:41:18 -0800 From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Wed, 18 Dec 2019 11:40:49 -0800 Message-Id: <54a89539673507106ae6fcde866f813bd5e95d5f.1576697796.git.tamas.lengyel@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: References: MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v2 12/20] 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_Pau_Monn=C3=A9?= 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=all 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 6e81e1a895..90b6371e2f 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 { static DEFINE_PER_CPU(pg_lock_data_t, __pld); -#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) != 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; } @@ -509,24 +508,24 @@ static int audit(void) /* Check the page owner. */ if ( page_get_owner(pg) != 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++; } /* 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++; } /* 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 = get_domain_by_id(g->domain); if ( d == NULL ) { - MEM_SHARING_DEBUG("Unknown dom: %hu, for PFN=%lx, MFN=%lx\n", - g->domain, g->gfn, mfn_x(mfn)); + gdprintk(XENLOG_ERR, + "Unknown dom: %hu, for PFN=%lx, MFN=%lx\n", + g->domain, g->gfn, mfn_x(mfn)); errors++; continue; } o_mfn = get_gfn_query_unlocked(d, g->gfn, &t); if ( !mfn_eq(o_mfn, mfn) ) { - MEM_SHARING_DEBUG("Incorrect P2M for d=%hu, PFN=%lx." - "Expecting MFN=%lx, got %lx\n", - g->domain, g->gfn, mfn_x(mfn), mfn_x(o_mfn)); + gdprintk(XENLOG_ERR, "Incorrect P2M for d=%hu, PFN=%lx." + "Expecting MFN=%lx, got %lx\n", + g->domain, g->gfn, mfn_x(mfn), mfn_x(o_mfn)); errors++; } if ( t != p2m_ram_shared ) { - MEM_SHARING_DEBUG("Incorrect P2M type for d=%hu, PFN=%lx MFN=%lx." - "Expecting t=%d, got %d\n", - g->domain, g->gfn, mfn_x(mfn), p2m_ram_shared, t); + gdprintk(XENLOG_ERR, + "Incorrect P2M type for d=%hu, PFN=%lx MFN=%lx." + "Expecting t=%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) != (pg->u.inuse.type_info & PGT_count_mask) ) { - MEM_SHARING_DEBUG("Mismatched counts for MFN=%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=%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++; } @@ -585,8 +586,8 @@ static int audit(void) if ( count_found != 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++; } @@ -765,12 +766,12 @@ static int debug_mfn(mfn_t mfn) return -EINVAL; } - MEM_SHARING_DEBUG( - "Debug page: MFN=%lx is ci=%lx, ti=%lx, owner_id=%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=%lx is ci=%lx, ti=%lx, owner_id=%d\n", + mfn_x(page_to_mfn(page)), + page->count_info, + page->u.inuse.type_info, + page_get_owner(page)->domain_id); /* -1 because the page is locked and that's an additional type ref */ num_refs = ((int) (page->u.inuse.type_info & PGT_count_mask)) - 1; @@ -786,8 +787,9 @@ static int debug_gfn(struct domain *d, gfn_t gfn) mfn = get_gfn_query(d, gfn_x(gfn), &p2mt); - MEM_SHARING_DEBUG("Debug for dom%d, gfn=%" PRI_gfn "\n", - d->domain_id, gfn_x(gfn)); + gdprintk(XENLOG_ERR, "Debug for dom%d, gfn=%" PRI_gfn "\n", + d->domain_id, gfn_x(gfn)); + num_refs = debug_mfn(mfn); put_gfn(d, gfn_x(gfn)); @@ -803,14 +805,13 @@ static int debug_gref(struct domain *d, grant_ref_t ref) rc = mem_sharing_gref_to_gfn(d->grant_table, ref, &gfn, &status); if ( rc ) { - MEM_SHARING_DEBUG("Asked to debug [dom=%d,gref=%u]: error %d.\n", - d->domain_id, ref, rc); + gdprintk(XENLOG_ERR, "Asked to debug [dom=%d,gref=%u]: error %d.\n", + d->domain_id, ref, rc); return rc; } - MEM_SHARING_DEBUG( - "==> Grant [dom=%d,ref=%d], status=%x. ", - d->domain_id, ref, status); + gdprintk(XENLOG_ERR, " ==> Grant [dom=%d,ref=%d], status=%x. ", + d->domain_id, ref, status); return debug_gfn(d, gfn); }