linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] xen-blkback: Change statistics counter types to unsigned
@ 2013-03-05 17:59 Zoltan Kiss
  2013-03-08 18:43 ` Konrad Rzeszutek Wilk
  0 siblings, 1 reply; 4+ messages in thread
From: Zoltan Kiss @ 2013-03-05 17:59 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk, linux-kernel; +Cc: Zoltan Kiss

These values shouldn't be negative, but after an overflow their value
can turn into negative, if they are signed. xentop can show bogus
values in this case.

Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Reported-by: Ichiro Ogino <ichiro.ogino@citrix.co.jp>
---
 drivers/block/xen-blkback/common.h |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 6072390..72d09ac 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -208,13 +208,13 @@ struct xen_blkif {
 
 	/* statistics */
 	unsigned long		st_print;
-	int			st_rd_req;
-	int			st_wr_req;
-	int			st_oo_req;
-	int			st_f_req;
-	int			st_ds_req;
-	int			st_rd_sect;
-	int			st_wr_sect;
+	unsigned long long			st_rd_req;
+	unsigned long long			st_wr_req;
+	unsigned long long			st_oo_req;
+	unsigned long long			st_f_req;
+	unsigned long long			st_ds_req;
+	unsigned long long			st_rd_sect;
+	unsigned long long			st_wr_sect;
 
 	wait_queue_head_t	waiting_to_free;
 };
-- 
1.7.0.4


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

* Re: [PATCH 1/1] xen-blkback: Change statistics counter types to unsigned
  2013-03-05 17:59 [PATCH 1/1] xen-blkback: Change statistics counter types to unsigned Zoltan Kiss
@ 2013-03-08 18:43 ` Konrad Rzeszutek Wilk
  2013-03-11 16:15   ` Zoltan Kiss
  2013-03-11 16:16   ` Zoltan Kiss
  0 siblings, 2 replies; 4+ messages in thread
From: Konrad Rzeszutek Wilk @ 2013-03-08 18:43 UTC (permalink / raw)
  To: Zoltan Kiss; +Cc: linux-kernel

On Tue, Mar 05, 2013 at 05:59:32PM +0000, Zoltan Kiss wrote:
> These values shouldn't be negative, but after an overflow their value
> can turn into negative, if they are signed. xentop can show bogus
> values in this case.

I get this during compilation:

/home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_oo_req’:
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c:233: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_rd_req’:
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c:234: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_wr_req’:
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c:235: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_f_req’:
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c:236: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_ds_req’:
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c:237: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_rd_sect’:
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c:238: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_wr_sect’:
/home/konrad/linux/drivers/block/xen-blkback/xenbus.c:239: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
  CC      block/bsg-lib.o
  CC      mm/dmapool.o
  CC      kernel/debug/debug_core.o
  CC      mm/hugetlb.o
  CC      mm/mempolicy.o
  CC      drivers/acpi/sleep.o
/home/konrad/linux/drivers/block/xen-blkback/blkback.c: In function ‘print_stats’:
/home/konrad/linux/drivers/block/xen-blkback/blkback.c:384: warning: format ‘%3d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
/home/konrad/linux/drivers/block/xen-blkback/blkback.c:384: warning: format ‘%4d’ expects type ‘int’, but argument 4 has type ‘long long unsigned int’
/home/konrad/linux/drivers/block/xen-blkback/blkback.c:384: warning: format ‘%4d’ expects type ‘int’, but argument 5 has type ‘lo

Could you fix it up please as one big patch if possible?

> 
> Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
> Reported-by: Ichiro Ogino <ichiro.ogino@citrix.co.jp>
> ---
>  drivers/block/xen-blkback/common.h |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
> index 6072390..72d09ac 100644
> --- a/drivers/block/xen-blkback/common.h
> +++ b/drivers/block/xen-blkback/common.h
> @@ -208,13 +208,13 @@ struct xen_blkif {
>  
>  	/* statistics */
>  	unsigned long		st_print;
> -	int			st_rd_req;
> -	int			st_wr_req;
> -	int			st_oo_req;
> -	int			st_f_req;
> -	int			st_ds_req;
> -	int			st_rd_sect;
> -	int			st_wr_sect;
> +	unsigned long long			st_rd_req;
> +	unsigned long long			st_wr_req;
> +	unsigned long long			st_oo_req;
> +	unsigned long long			st_f_req;
> +	unsigned long long			st_ds_req;
> +	unsigned long long			st_rd_sect;
> +	unsigned long long			st_wr_sect;
>  
>  	wait_queue_head_t	waiting_to_free;
>  };
> -- 
> 1.7.0.4
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

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

* [PATCH 1/1] xen-blkback: Change statistics counter types to unsigned
  2013-03-08 18:43 ` Konrad Rzeszutek Wilk
@ 2013-03-11 16:15   ` Zoltan Kiss
  2013-03-11 16:16   ` Zoltan Kiss
  1 sibling, 0 replies; 4+ messages in thread
From: Zoltan Kiss @ 2013-03-11 16:15 UTC (permalink / raw)
  To: linux-kernel, konrad.wilk; +Cc: Zoltan Kiss

These values shouldn't be negative, but after an overflow their value
can turn into negative, if they are signed. xentop can show bogus
values in this case.

Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Reported-by: Ichiro Ogino <ichiro.ogino@citrix.co.jp>
---
 drivers/block/xen-blkback/blkback.c |    4 ++--
 drivers/block/xen-blkback/common.h  |   14 +++++++-------
 drivers/block/xen-blkback/xenbus.c  |   14 +++++++-------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index de1f319..75740f9 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -381,8 +381,8 @@ irqreturn_t xen_blkif_be_int(int irq, void *dev_id)
 
 static void print_stats(struct xen_blkif *blkif)
 {
-	pr_info("xen-blkback (%s): oo %3d  |  rd %4d  |  wr %4d  |  f %4d"
-		 "  |  ds %4d\n",
+	pr_info("xen-blkback (%s): oo %3llu  |  rd %4llu  |  wr %4llu  |  f %4llu"
+		 "  |  ds %4llu\n",
 		 current->comm, blkif->st_oo_req,
 		 blkif->st_rd_req, blkif->st_wr_req,
 		 blkif->st_f_req, blkif->st_ds_req);
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 6072390..72d09ac 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -208,13 +208,13 @@ struct xen_blkif {
 
 	/* statistics */
 	unsigned long		st_print;
-	int			st_rd_req;
-	int			st_wr_req;
-	int			st_oo_req;
-	int			st_f_req;
-	int			st_ds_req;
-	int			st_rd_sect;
-	int			st_wr_sect;
+	unsigned long long			st_rd_req;
+	unsigned long long			st_wr_req;
+	unsigned long long			st_oo_req;
+	unsigned long long			st_f_req;
+	unsigned long long			st_ds_req;
+	unsigned long long			st_rd_sect;
+	unsigned long long			st_wr_sect;
 
 	wait_queue_head_t	waiting_to_free;
 };
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 5e237f6..8bfd1bc 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -230,13 +230,13 @@ int __init xen_blkif_interface_init(void)
 	}								\
 	static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
 
-VBD_SHOW(oo_req,  "%d\n", be->blkif->st_oo_req);
-VBD_SHOW(rd_req,  "%d\n", be->blkif->st_rd_req);
-VBD_SHOW(wr_req,  "%d\n", be->blkif->st_wr_req);
-VBD_SHOW(f_req,  "%d\n", be->blkif->st_f_req);
-VBD_SHOW(ds_req,  "%d\n", be->blkif->st_ds_req);
-VBD_SHOW(rd_sect, "%d\n", be->blkif->st_rd_sect);
-VBD_SHOW(wr_sect, "%d\n", be->blkif->st_wr_sect);
+VBD_SHOW(oo_req,  "%llu\n", be->blkif->st_oo_req);
+VBD_SHOW(rd_req,  "%llu\n", be->blkif->st_rd_req);
+VBD_SHOW(wr_req,  "%llu\n", be->blkif->st_wr_req);
+VBD_SHOW(f_req,  "%llu\n", be->blkif->st_f_req);
+VBD_SHOW(ds_req,  "%llu\n", be->blkif->st_ds_req);
+VBD_SHOW(rd_sect, "%llu\n", be->blkif->st_rd_sect);
+VBD_SHOW(wr_sect, "%llu\n", be->blkif->st_wr_sect);
 
 static struct attribute *xen_vbdstat_attrs[] = {
 	&dev_attr_oo_req.attr,
-- 
1.7.0.4


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

* Re: [PATCH 1/1] xen-blkback: Change statistics counter types to unsigned
  2013-03-08 18:43 ` Konrad Rzeszutek Wilk
  2013-03-11 16:15   ` Zoltan Kiss
@ 2013-03-11 16:16   ` Zoltan Kiss
  1 sibling, 0 replies; 4+ messages in thread
From: Zoltan Kiss @ 2013-03-11 16:16 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 4218 bytes --]

Done, just sent in in separate mail.

On 08/03/13 18:43, Konrad Rzeszutek Wilk wrote:
> On Tue, Mar 05, 2013 at 05:59:32PM +0000, Zoltan Kiss wrote:
>> These values shouldn't be negative, but after an overflow their value
>> can turn into negative, if they are signed. xentop can show bogus
>> values in this case.
>
> I get this during compilation:
>
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_oo_req’:
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c:233: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_rd_req’:
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c:234: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_wr_req’:
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c:235: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_f_req’:
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c:236: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_ds_req’:
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c:237: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_rd_sect’:
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c:238: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c: In function ‘show_wr_sect’:
> /home/konrad/linux/drivers/block/xen-blkback/xenbus.c:239: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
>    CC      block/bsg-lib.o
>    CC      mm/dmapool.o
>    CC      kernel/debug/debug_core.o
>    CC      mm/hugetlb.o
>    CC      mm/mempolicy.o
>    CC      drivers/acpi/sleep.o
> /home/konrad/linux/drivers/block/xen-blkback/blkback.c: In function ‘print_stats’:
> /home/konrad/linux/drivers/block/xen-blkback/blkback.c:384: warning: format ‘%3d’ expects type ‘int’, but argument 3 has type ‘long long unsigned int’
> /home/konrad/linux/drivers/block/xen-blkback/blkback.c:384: warning: format ‘%4d’ expects type ‘int’, but argument 4 has type ‘long long unsigned int’
> /home/konrad/linux/drivers/block/xen-blkback/blkback.c:384: warning: format ‘%4d’ expects type ‘int’, but argument 5 has type ‘lo
>
> Could you fix it up please as one big patch if possible?
>
>>
>> Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
>> Reported-by: Ichiro Ogino <ichiro.ogino@citrix.co.jp>
>> ---
>>   drivers/block/xen-blkback/common.h |   14 +++++++-------
>>   1 files changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
>> index 6072390..72d09ac 100644
>> --- a/drivers/block/xen-blkback/common.h
>> +++ b/drivers/block/xen-blkback/common.h
>> @@ -208,13 +208,13 @@ struct xen_blkif {
>>
>>   	/* statistics */
>>   	unsigned long		st_print;
>> -	int			st_rd_req;
>> -	int			st_wr_req;
>> -	int			st_oo_req;
>> -	int			st_f_req;
>> -	int			st_ds_req;
>> -	int			st_rd_sect;
>> -	int			st_wr_sect;
>> +	unsigned long long			st_rd_req;
>> +	unsigned long long			st_wr_req;
>> +	unsigned long long			st_oo_req;
>> +	unsigned long long			st_f_req;
>> +	unsigned long long			st_ds_req;
>> +	unsigned long long			st_rd_sect;
>> +	unsigned long long			st_wr_sect;
>>
>>   	wait_queue_head_t	waiting_to_free;
>>   };
>> --
>> 1.7.0.4
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
>>


[-- Attachment #2: 0001-xen-blkback-Change-statistics-counter-types-to-unsig.patch --]
[-- Type: text/x-patch, Size: 3192 bytes --]

>From a7e938cfd0685285d807697feb1742784101a6c5 Mon Sep 17 00:00:00 2001
From: Zoltan Kiss <zoltan.kiss@citrix.com>
Date: Mon, 11 Mar 2013 15:52:17 +0000
Subject: [PATCH 1/1] xen-blkback: Change statistics counter types to unsigned

These values shouldn't be negative, but after an overflow their value
can turn into negative, if they are signed. xentop can show bogus
values in this case.

Signed-off-by: Zoltan Kiss <zoltan.kiss@citrix.com>
Reported-by: Ichiro Ogino <ichiro.ogino@citrix.co.jp>
---
 drivers/block/xen-blkback/blkback.c |    4 ++--
 drivers/block/xen-blkback/common.h  |   14 +++++++-------
 drivers/block/xen-blkback/xenbus.c  |   14 +++++++-------
 3 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
index de1f319..75740f9 100644
--- a/drivers/block/xen-blkback/blkback.c
+++ b/drivers/block/xen-blkback/blkback.c
@@ -381,8 +381,8 @@ irqreturn_t xen_blkif_be_int(int irq, void *dev_id)
 
 static void print_stats(struct xen_blkif *blkif)
 {
-	pr_info("xen-blkback (%s): oo %3d  |  rd %4d  |  wr %4d  |  f %4d"
-		 "  |  ds %4d\n",
+	pr_info("xen-blkback (%s): oo %3llu  |  rd %4llu  |  wr %4llu  |  f %4llu"
+		 "  |  ds %4llu\n",
 		 current->comm, blkif->st_oo_req,
 		 blkif->st_rd_req, blkif->st_wr_req,
 		 blkif->st_f_req, blkif->st_ds_req);
diff --git a/drivers/block/xen-blkback/common.h b/drivers/block/xen-blkback/common.h
index 6072390..72d09ac 100644
--- a/drivers/block/xen-blkback/common.h
+++ b/drivers/block/xen-blkback/common.h
@@ -208,13 +208,13 @@ struct xen_blkif {
 
 	/* statistics */
 	unsigned long		st_print;
-	int			st_rd_req;
-	int			st_wr_req;
-	int			st_oo_req;
-	int			st_f_req;
-	int			st_ds_req;
-	int			st_rd_sect;
-	int			st_wr_sect;
+	unsigned long long			st_rd_req;
+	unsigned long long			st_wr_req;
+	unsigned long long			st_oo_req;
+	unsigned long long			st_f_req;
+	unsigned long long			st_ds_req;
+	unsigned long long			st_rd_sect;
+	unsigned long long			st_wr_sect;
 
 	wait_queue_head_t	waiting_to_free;
 };
diff --git a/drivers/block/xen-blkback/xenbus.c b/drivers/block/xen-blkback/xenbus.c
index 5e237f6..8bfd1bc 100644
--- a/drivers/block/xen-blkback/xenbus.c
+++ b/drivers/block/xen-blkback/xenbus.c
@@ -230,13 +230,13 @@ int __init xen_blkif_interface_init(void)
 	}								\
 	static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
 
-VBD_SHOW(oo_req,  "%d\n", be->blkif->st_oo_req);
-VBD_SHOW(rd_req,  "%d\n", be->blkif->st_rd_req);
-VBD_SHOW(wr_req,  "%d\n", be->blkif->st_wr_req);
-VBD_SHOW(f_req,  "%d\n", be->blkif->st_f_req);
-VBD_SHOW(ds_req,  "%d\n", be->blkif->st_ds_req);
-VBD_SHOW(rd_sect, "%d\n", be->blkif->st_rd_sect);
-VBD_SHOW(wr_sect, "%d\n", be->blkif->st_wr_sect);
+VBD_SHOW(oo_req,  "%llu\n", be->blkif->st_oo_req);
+VBD_SHOW(rd_req,  "%llu\n", be->blkif->st_rd_req);
+VBD_SHOW(wr_req,  "%llu\n", be->blkif->st_wr_req);
+VBD_SHOW(f_req,  "%llu\n", be->blkif->st_f_req);
+VBD_SHOW(ds_req,  "%llu\n", be->blkif->st_ds_req);
+VBD_SHOW(rd_sect, "%llu\n", be->blkif->st_rd_sect);
+VBD_SHOW(wr_sect, "%llu\n", be->blkif->st_wr_sect);
 
 static struct attribute *xen_vbdstat_attrs[] = {
 	&dev_attr_oo_req.attr,
-- 
1.7.0.4


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

end of thread, other threads:[~2013-03-11 16:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-05 17:59 [PATCH 1/1] xen-blkback: Change statistics counter types to unsigned Zoltan Kiss
2013-03-08 18:43 ` Konrad Rzeszutek Wilk
2013-03-11 16:15   ` Zoltan Kiss
2013-03-11 16:16   ` Zoltan Kiss

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).