netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] net: openvswitch: suitable access to the dp_meters
@ 2020-04-25  3:39 xiangxia.m.yue
  2020-04-25  3:39 ` [PATCH 2/2] net: openvswitch: use div_u64() for 64-by-32 divisions xiangxia.m.yue
  2020-04-26  3:48 ` [PATCH 1/2] net: openvswitch: suitable access to the dp_meters David Miller
  0 siblings, 2 replies; 4+ messages in thread
From: xiangxia.m.yue @ 2020-04-25  3:39 UTC (permalink / raw)
  To: eric.dumazet, geert, pshelar, davem, kuba
  Cc: netdev, linux-kernel, Tonghao Zhang

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

To fix the following sparse warning:
| net/openvswitch/meter.c:109:38: sparse: sparse: incorrect type
| in assignment (different address spaces) ...
| net/openvswitch/meter.c:720:45: sparse: sparse: incorrect type
| in argument 1 (different address spaces) ...

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
 net/openvswitch/meter.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 915f31123f23..612ad5586ce9 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -107,8 +107,8 @@ dp_meter_instance_realloc(struct dp_meter_table *tbl, u32 size)
 		return -ENOMEM;
 
 	for (i = 0; i < n_meters; i++)
-		new_ti->dp_meters[i] =
-			rcu_dereference_ovsl(ti->dp_meters[i]);
+		if (rcu_dereference_ovsl(ti->dp_meters[i]))
+			new_ti->dp_meters[i] = ti->dp_meters[i];
 
 	rcu_assign_pointer(tbl->ti, new_ti);
 	call_rcu(&ti->rcu, dp_meter_instance_free_rcu);
@@ -752,7 +752,7 @@ void ovs_meters_exit(struct datapath *dp)
 	int i;
 
 	for (i = 0; i < ti->n_meters; i++)
-		ovs_meter_free(ti->dp_meters[i]);
+		ovs_meter_free(rcu_dereference_raw(ti->dp_meters[i]));
 
 	dp_meter_instance_free(ti);
 }
-- 
2.23.0


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

* [PATCH 2/2] net: openvswitch: use div_u64() for 64-by-32 divisions
  2020-04-25  3:39 [PATCH 1/2] net: openvswitch: suitable access to the dp_meters xiangxia.m.yue
@ 2020-04-25  3:39 ` xiangxia.m.yue
  2020-04-26  3:48   ` David Miller
  2020-04-26  3:48 ` [PATCH 1/2] net: openvswitch: suitable access to the dp_meters David Miller
  1 sibling, 1 reply; 4+ messages in thread
From: xiangxia.m.yue @ 2020-04-25  3:39 UTC (permalink / raw)
  To: eric.dumazet, geert, pshelar, davem, kuba
  Cc: netdev, linux-kernel, Tonghao Zhang

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Compile the kernel for arm 32 platform, the build warning found.
To fix that, should use div_u64() for divisions.
| net/openvswitch/meter.c:396: undefined reference to `__udivdi3'

[add more commit msg, change reported tag, and use div_u64 instead
of do_div by Tonghao]

Fixes: e57358873bb5d6ca ("net: openvswitch: use u64 for meter bucket")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Tested-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
The author should be:
Geert Uytterhoeven <geert@linux-m68k.org>
---
 net/openvswitch/meter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/openvswitch/meter.c b/net/openvswitch/meter.c
index 612ad5586ce9..3d3d8e094546 100644
--- a/net/openvswitch/meter.c
+++ b/net/openvswitch/meter.c
@@ -393,7 +393,7 @@ static struct dp_meter *dp_meter_create(struct nlattr **a)
 		 * Start with a full bucket.
 		 */
 		band->bucket = (band->burst_size + band->rate) * 1000ULL;
-		band_max_delta_t = band->bucket / band->rate;
+		band_max_delta_t = div_u64(band->bucket, band->rate);
 		if (band_max_delta_t > meter->max_delta_t)
 			meter->max_delta_t = band_max_delta_t;
 		band++;
-- 
2.23.0


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

* Re: [PATCH 1/2] net: openvswitch: suitable access to the dp_meters
  2020-04-25  3:39 [PATCH 1/2] net: openvswitch: suitable access to the dp_meters xiangxia.m.yue
  2020-04-25  3:39 ` [PATCH 2/2] net: openvswitch: use div_u64() for 64-by-32 divisions xiangxia.m.yue
@ 2020-04-26  3:48 ` David Miller
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2020-04-26  3:48 UTC (permalink / raw)
  To: xiangxia.m.yue; +Cc: eric.dumazet, geert, pshelar, kuba, netdev, linux-kernel

From: xiangxia.m.yue@gmail.com
Date: Sat, 25 Apr 2020 11:39:47 +0800

> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> To fix the following sparse warning:
> | net/openvswitch/meter.c:109:38: sparse: sparse: incorrect type
> | in assignment (different address spaces) ...
> | net/openvswitch/meter.c:720:45: sparse: sparse: incorrect type
> | in argument 1 (different address spaces) ...
> 
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Applied.

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

* Re: [PATCH 2/2] net: openvswitch: use div_u64() for 64-by-32 divisions
  2020-04-25  3:39 ` [PATCH 2/2] net: openvswitch: use div_u64() for 64-by-32 divisions xiangxia.m.yue
@ 2020-04-26  3:48   ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2020-04-26  3:48 UTC (permalink / raw)
  To: xiangxia.m.yue; +Cc: eric.dumazet, geert, pshelar, kuba, netdev, linux-kernel

From: xiangxia.m.yue@gmail.com
Date: Sat, 25 Apr 2020 11:39:48 +0800

> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> 
> Compile the kernel for arm 32 platform, the build warning found.
> To fix that, should use div_u64() for divisions.
> | net/openvswitch/meter.c:396: undefined reference to `__udivdi3'
> 
> [add more commit msg, change reported tag, and use div_u64 instead
> of do_div by Tonghao]
> 
> Fixes: e57358873bb5d6ca ("net: openvswitch: use u64 for meter bucket")
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> Tested-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>

Applied.

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

end of thread, other threads:[~2020-04-26  3:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-25  3:39 [PATCH 1/2] net: openvswitch: suitable access to the dp_meters xiangxia.m.yue
2020-04-25  3:39 ` [PATCH 2/2] net: openvswitch: use div_u64() for 64-by-32 divisions xiangxia.m.yue
2020-04-26  3:48   ` David Miller
2020-04-26  3:48 ` [PATCH 1/2] net: openvswitch: suitable access to the dp_meters David Miller

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).