Message ID | 585D338C.5020905@greenhost.nl |
---|---|
State | New |
Headers | show |
On 23/12/16 15:24, Mart van Santen wrote: > Hello Xen Devel, > > We encountered an issue with one of our instances pushing a lot of > (network) data, resulting in incorrect bandwidth reporting. We do poll > interface traffic every 5 minutes for every interface of our instances > (from Dom0) and store those values for reporting/graphing. At some point > we discovered reports of machines pushing a lot of data, were incorrect > and were going down in chucks of about 4 GB, while you expect this is an > always increasing number (or wraps around a 32 or 64 bit counter) > > After futher analysing the problem and the source code we discovered > that the counters of the queues in the code are handled as 32-bit > integers, while the total bytes tx/rx for the while interface are > counted as 64-bit longs. > > > Attached a patch to solve the problem. ... > --- a/drivers/net/xen-netback/common.h 2016-12-22 15:41:07.785535748 +0000 > +++ b/drivers/net/xen-netback/common.h 2016-12-23 13:08:18.123080064 +0000 > @@ -119,10 +119,10 @@ > * A subset of struct net_device_stats that contains only the > * fields that are updated in netback.c for each queue. > */ > - unsigned int rx_bytes; > - unsigned int rx_packets; > - unsigned int tx_bytes; > - unsigned int tx_packets; > + unsigned long rx_bytes; > + unsigned long rx_packets; > + unsigned long tx_bytes; > + unsigned long tx_packets; So on 32 bit kernels you'll still encounter the same problem. Please use the type "u64" as (nearly) everywhere else. You might want to read Documentation/SubmittingPatches in the Linux kernel source tree. Juergen
--- a/drivers/net/xen-netback/common.h 2016-12-22 15:41:07.785535748 +0000 +++ b/drivers/net/xen-netback/common.h 2016-12-23 13:08:18.123080064 +0000 @@ -119,10 +119,10 @@ * A subset of struct net_device_stats that contains only the * fields that are updated in netback.c for each queue. */ - unsigned int rx_bytes; - unsigned int rx_packets; - unsigned int tx_bytes; - unsigned int tx_packets; + unsigned long rx_bytes; + unsigned long rx_packets; + unsigned long tx_bytes; + unsigned long tx_packets; /* Additional stats used by xenvif */ unsigned long rx_gso_checksum_fixup;