Re: [Xen-devel] [PATCH v6 4/9] x86/mem_sharing: Replace MEM_SHARING_DEBUG with gdprintk

2020-01-28 Thread Jan Beulich
On 27.01.2020 19:06, Tamas K Lengyel wrote:
> Using XENLOG_ERR level since this is only used in debug paths (ie. it's
> expected the user already has loglvl=all set). Also use %pd to print the 
> domain
> ids.
> 
> Signed-off-by: Tamas K Lengyel 

Acked-by: Jan Beulich 


___
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

[Xen-devel] [PATCH v6 4/9] x86/mem_sharing: Replace MEM_SHARING_DEBUG with gdprintk

2020-01-27 Thread Tamas K Lengyel
Using XENLOG_ERR level since this is only used in debug paths (ie. it's
expected the user already has loglvl=all 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 5ce075d307..2b3be5b125 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   \
@@ -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) != 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) != 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++;
 }
 
 /* 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_count(pg) == 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 = 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: %d, for PFN=%lx, MFN=%lx\n",
+ g->domain, g->gfn, mfn_x(mfn));
 errors++;
 continue;
 }
 o_mfn = get_gfn_query_unlocked(d, g->gfn, );
 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 %pd, PFN=%lx."
+ "Expecting MFN=%lx, got %lx\n",
+ d, 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 %pd, PFN=%lx MFN=%lx."
+ "Expecting t=%d, got %d\n",
+ d, g->gfn, mfn_x(mfn), p2m_ram_shared, t);
 errors++;
 }
 put_domain(d);
@@ -564,10 +563,10 @@ static int