All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc/mm/slice: Update slice mask printing to use bitmap printing.
@ 2017-02-13 11:10 Aneesh Kumar K.V
  2017-02-13 11:57 ` Aneesh Kumar K.V
  0 siblings, 1 reply; 2+ messages in thread
From: Aneesh Kumar K.V @ 2017-02-13 11:10 UTC (permalink / raw)
  To: benh, paulus, mpe, Balbir Singh; +Cc: linuxppc-dev, Aneesh Kumar K.V

We now get output like below which is much better.

[    0.935306]  good_mask low_slice: 4-5,9,11-13
[    0.935360]  good_mask high_slice: 0-511
[    0.935385]  mask low_slice: 3-6,8,10-12
[    0.935397]  mask high_slice:

Compared to

[    0.953414]  good_mask:1111111111111111 - 1111111111111.........

I also fixed an error with slice_dbg printing.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
---
 arch/powerpc/mm/slice.c | 30 +++++++-----------------------
 1 file changed, 7 insertions(+), 23 deletions(-)

diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
index b3f45e413a60..0575897fdbe3 100644
--- a/arch/powerpc/mm/slice.c
+++ b/arch/powerpc/mm/slice.c
@@ -44,29 +44,13 @@ int _slice_debug = 1;
 
 static void slice_print_mask(const char *label, struct slice_mask mask)
 {
-	char	*p, buf[SLICE_NUM_LOW + 3 + SLICE_NUM_HIGH + 1];
-	int	i;
-
 	if (!_slice_debug)
 		return;
-	p = buf;
-	for (i = 0; i < SLICE_NUM_LOW; i++)
-		*(p++) = (mask.low_slices & (1 << i)) ? '1' : '0';
-	*(p++) = ' ';
-	*(p++) = '-';
-	*(p++) = ' ';
-	for (i = 0; i < SLICE_NUM_HIGH; i++) {
-		if (test_bit(i, mask.high_slices))
-			*(p++) = '1';
-		else
-			*(p++) = '0';
-	}
-	*(p++) = 0;
-
-	printk(KERN_DEBUG "%s:%s\n", label, buf);
+	pr_devel("%s low_slice: %*pbl\n", label, (int)SLICE_NUM_LOW, &mask.low_slices);
+	pr_devel("%s high_slice: %*pbl\n", label, (int)SLICE_NUM_HIGH, mask.high_slices);
 }
 
-#define slice_dbg(fmt...) do { if (_slice_debug) pr_debug(fmt); } while(0)
+#define slice_dbg(fmt...) do { if (_slice_debug) pr_devel(fmt); } while (0)
 
 #else
 
@@ -233,8 +217,8 @@ static void slice_convert(struct mm_struct *mm, struct slice_mask mask, int psiz
 	}
 
 	slice_dbg(" lsps=%lx, hsps=%lx\n",
-		  mm->context.low_slices_psize,
-		  mm->context.high_slices_psize);
+		  (unsigned long)mm->context.low_slices_psize,
+		  (unsigned long)mm->context.high_slices_psize);
 
 	spin_unlock_irqrestore(&slice_convert_lock, flags);
 
@@ -678,8 +662,8 @@ void slice_set_user_psize(struct mm_struct *mm, unsigned int psize)
 
 
 	slice_dbg(" lsps=%lx, hsps=%lx\n",
-		  mm->context.low_slices_psize,
-		  mm->context.high_slices_psize);
+		  (unsigned long)mm->context.low_slices_psize,
+		  (unsigned long)mm->context.high_slices_psize);
 
  bail:
 	spin_unlock_irqrestore(&slice_convert_lock, flags);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] powerpc/mm/slice: Update slice mask printing to use bitmap printing.
  2017-02-13 11:10 [PATCH] powerpc/mm/slice: Update slice mask printing to use bitmap printing Aneesh Kumar K.V
@ 2017-02-13 11:57 ` Aneesh Kumar K.V
  0 siblings, 0 replies; 2+ messages in thread
From: Aneesh Kumar K.V @ 2017-02-13 11:57 UTC (permalink / raw)
  To: benh, paulus, mpe, Balbir Singh; +Cc: linuxppc-dev



On Monday 13 February 2017 04:40 PM, Aneesh Kumar K.V wrote:
> We now get output like below which is much better.
>
> [    0.935306]  good_mask low_slice: 4-5,9,11-13
> [    0.935360]  good_mask high_slice: 0-511
> [    0.935385]  mask low_slice: 3-6,8,10-12
> [    0.935397]  mask high_slice:
>
> Compared to
>
> [    0.953414]  good_mask:1111111111111111 - 1111111111111.........
>
> I also fixed an error with slice_dbg printing.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
> ---
>   arch/powerpc/mm/slice.c | 30 +++++++-----------------------
>   1 file changed, 7 insertions(+), 23 deletions(-)
>
> diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c
> index b3f45e413a60..0575897fdbe3 100644
> --- a/arch/powerpc/mm/slice.c
> +++ b/arch/powerpc/mm/slice.c
> @@ -44,29 +44,13 @@ int _slice_debug = 1;
>
>   static void slice_print_mask(const char *label, struct slice_mask mask)
>   {
> -	char	*p, buf[SLICE_NUM_LOW + 3 + SLICE_NUM_HIGH + 1];
> -	int	i;
> -
>   	if (!_slice_debug)
>   		return;
> -	p = buf;
> -	for (i = 0; i < SLICE_NUM_LOW; i++)
> -		*(p++) = (mask.low_slices & (1 << i)) ? '1' : '0';
> -	*(p++) = ' ';
> -	*(p++) = '-';
> -	*(p++) = ' ';
> -	for (i = 0; i < SLICE_NUM_HIGH; i++) {
> -		if (test_bit(i, mask.high_slices))
> -			*(p++) = '1';
> -		else
> -			*(p++) = '0';
> -	}
> -	*(p++) = 0;
> -
> -	printk(KERN_DEBUG "%s:%s\n", label, buf);
> +	pr_devel("%s low_slice: %*pbl\n", label, (int)SLICE_NUM_LOW, &mask.low_slices);


This doesn't work as expected because low_slices is of type u16. I am 
fixing that to be u64.


> +	pr_devel("%s high_slice: %*pbl\n", label, (int)SLICE_NUM_HIGH, mask.high_slices);
>   }
>
> -#define slice_dbg(fmt...) do { if (_slice_debug) pr_debug(fmt); } while(0)
> +#define slice_dbg(fmt...) do { if (_slice_debug) pr_devel(fmt); } while (0)
>
>   #else
>
> @@ -233,8 +217,8 @@ static void slice_convert(struct mm_struct *mm, struct slice_mask mask, int psiz
>   	}
>
>   	slice_dbg(" lsps=%lx, hsps=%lx\n",
> -		  mm->context.low_slices_psize,
> -		  mm->context.high_slices_psize);
> +		  (unsigned long)mm->context.low_slices_psize,
> +		  (unsigned long)mm->context.high_slices_psize);
>
>   	spin_unlock_irqrestore(&slice_convert_lock, flags);
>
> @@ -678,8 +662,8 @@ void slice_set_user_psize(struct mm_struct *mm, unsigned int psize)
>
>
>   	slice_dbg(" lsps=%lx, hsps=%lx\n",
> -		  mm->context.low_slices_psize,
> -		  mm->context.high_slices_psize);
> +		  (unsigned long)mm->context.low_slices_psize,
> +		  (unsigned long)mm->context.high_slices_psize);
>
>    bail:
>   	spin_unlock_irqrestore(&slice_convert_lock, flags);

-aneesh

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-13 11:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-13 11:10 [PATCH] powerpc/mm/slice: Update slice mask printing to use bitmap printing Aneesh Kumar K.V
2017-02-13 11:57 ` Aneesh Kumar K.V

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.