Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH net-next 0/3] openvswitch: per-cpu upcall patchwork issues
@ 2021-07-23 14:24 Mark Gray
  2021-07-23 14:24 ` [PATCH net-next 1/3] openvswitch: update kdoc OVS_DP_ATTR_PER_CPU_PIDS Mark Gray
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mark Gray @ 2021-07-23 14:24 UTC (permalink / raw)
  To: netdev, dev; +Cc: pshelar, davem, kuba, Mark Gray

Some issues were raised by patchwork at:\r
https://patchwork.kernel.org/project/netdevbpf/patch/20210630095350.817785-1-mark.d.gray@redhat.com/#24285159\r
\r
Mark Gray (3):\r
  openvswitch: update kdoc OVS_DP_ATTR_PER_CPU_PIDS\r
  openvswitch: fix alignment issues\r
  openvswitch: fix sparse warning incorrect type\r
\r
 include/uapi/linux/openvswitch.h |  6 +++---\r
 net/openvswitch/actions.c        |  6 ++++--\r
 net/openvswitch/datapath.c       | 18 +++++++++++-------\r
 3 files changed, 18 insertions(+), 12 deletions(-)\r
\r
-- \r
2.27.0\r
\r


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

* [PATCH net-next 1/3] openvswitch: update kdoc OVS_DP_ATTR_PER_CPU_PIDS
  2021-07-23 14:24 [PATCH net-next 0/3] openvswitch: per-cpu upcall patchwork issues Mark Gray
@ 2021-07-23 14:24 ` Mark Gray
  2021-07-23 14:24 ` [PATCH net-next 2/3] openvswitch: fix alignment issues Mark Gray
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Gray @ 2021-07-23 14:24 UTC (permalink / raw)
  To: netdev, dev; +Cc: pshelar, davem, kuba, Mark Gray

Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
---
 include/uapi/linux/openvswitch.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 6571b57b2268..0e436a3755f1 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -70,7 +70,7 @@ enum ovs_datapath_cmd {
  * set on the datapath port (for OVS_ACTION_ATTR_MISS).  Only valid on
  * %OVS_DP_CMD_NEW requests. A value of zero indicates that upcalls should
  * not be sent.
- * OVS_DP_ATTR_PER_CPU_PIDS: Per-cpu array of PIDs for upcalls when
+ * @OVS_DP_ATTR_PER_CPU_PIDS: Per-cpu array of PIDs for upcalls when
  * OVS_DP_F_DISPATCH_UPCALL_PER_CPU feature is set.
  * @OVS_DP_ATTR_STATS: Statistics about packets that have passed through the
  * datapath.  Always present in notifications.
-- 
2.27.0


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

* [PATCH net-next 2/3] openvswitch: fix alignment issues
  2021-07-23 14:24 [PATCH net-next 0/3] openvswitch: per-cpu upcall patchwork issues Mark Gray
  2021-07-23 14:24 ` [PATCH net-next 1/3] openvswitch: update kdoc OVS_DP_ATTR_PER_CPU_PIDS Mark Gray
@ 2021-07-23 14:24 ` Mark Gray
  2021-07-23 14:24 ` [PATCH net-next 3/3] openvswitch: fix sparse warning incorrect type Mark Gray
  2021-07-27 11:00 ` [PATCH net-next 0/3] openvswitch: per-cpu upcall patchwork issues patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Gray @ 2021-07-23 14:24 UTC (permalink / raw)
  To: netdev, dev; +Cc: pshelar, davem, kuba, Mark Gray

Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
---
 include/uapi/linux/openvswitch.h |  4 ++--
 net/openvswitch/actions.c        |  6 ++++--
 net/openvswitch/datapath.c       | 16 ++++++++++------
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index 0e436a3755f1..150bcff49b1c 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -89,8 +89,8 @@ enum ovs_datapath_attr {
 	OVS_DP_ATTR_USER_FEATURES,	/* OVS_DP_F_*  */
 	OVS_DP_ATTR_PAD,
 	OVS_DP_ATTR_MASKS_CACHE_SIZE,
-	OVS_DP_ATTR_PER_CPU_PIDS,   /* Netlink PIDS to receive upcalls in per-cpu
-				     * dispatch mode
+	OVS_DP_ATTR_PER_CPU_PIDS,   /* Netlink PIDS to receive upcalls in
+				     * per-cpu dispatch mode
 				     */
 	__OVS_DP_ATTR_MAX
 };
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index f79679746c62..076774034bb9 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -924,9 +924,11 @@ static int output_userspace(struct datapath *dp, struct sk_buff *skb,
 			break;
 
 		case OVS_USERSPACE_ATTR_PID:
-			if (dp->user_features & OVS_DP_F_DISPATCH_UPCALL_PER_CPU)
+			if (dp->user_features &
+			    OVS_DP_F_DISPATCH_UPCALL_PER_CPU)
 				upcall.portid =
-				   ovs_dp_get_upcall_portid(dp, smp_processor_id());
+				  ovs_dp_get_upcall_portid(dp,
+							   smp_processor_id());
 			else
 				upcall.portid = nla_get_u32(a);
 			break;
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index 7a4edafdc685..e6f0ae5618dd 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -244,7 +244,8 @@ void ovs_dp_process_packet(struct sk_buff *skb, struct sw_flow_key *key)
 		upcall.cmd = OVS_PACKET_CMD_MISS;
 
 		if (dp->user_features & OVS_DP_F_DISPATCH_UPCALL_PER_CPU)
-			upcall.portid = ovs_dp_get_upcall_portid(dp, smp_processor_id());
+			upcall.portid =
+			    ovs_dp_get_upcall_portid(dp, smp_processor_id());
 		else
 			upcall.portid = ovs_vport_find_upcall_portid(p, skb);
 
@@ -1636,13 +1637,16 @@ u32 ovs_dp_get_upcall_portid(const struct datapath *dp, uint32_t cpu_id)
 	if (dp_nlsk_pids) {
 		if (cpu_id < dp_nlsk_pids->n_pids) {
 			return dp_nlsk_pids->pids[cpu_id];
-		} else if (dp_nlsk_pids->n_pids > 0 && cpu_id >= dp_nlsk_pids->n_pids) {
-			/* If the number of netlink PIDs is mismatched with the number of
-			 * CPUs as seen by the kernel, log this and send the upcall to an
-			 * arbitrary socket (0) in order to not drop packets
+		} else if (dp_nlsk_pids->n_pids > 0 &&
+			   cpu_id >= dp_nlsk_pids->n_pids) {
+			/* If the number of netlink PIDs is mismatched with
+			 * the number of CPUs as seen by the kernel, log this
+			 * and send the upcall to an arbitrary socket (0) in
+			 * order to not drop packets
 			 */
 			pr_info_ratelimited("cpu_id mismatch with handler threads");
-			return dp_nlsk_pids->pids[cpu_id % dp_nlsk_pids->n_pids];
+			return dp_nlsk_pids->pids[cpu_id %
+						  dp_nlsk_pids->n_pids];
 		} else {
 			return 0;
 		}
-- 
2.27.0


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

* [PATCH net-next 3/3] openvswitch: fix sparse warning incorrect type
  2021-07-23 14:24 [PATCH net-next 0/3] openvswitch: per-cpu upcall patchwork issues Mark Gray
  2021-07-23 14:24 ` [PATCH net-next 1/3] openvswitch: update kdoc OVS_DP_ATTR_PER_CPU_PIDS Mark Gray
  2021-07-23 14:24 ` [PATCH net-next 2/3] openvswitch: fix alignment issues Mark Gray
@ 2021-07-23 14:24 ` Mark Gray
  2021-07-27 11:00 ` [PATCH net-next 0/3] openvswitch: per-cpu upcall patchwork issues patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: Mark Gray @ 2021-07-23 14:24 UTC (permalink / raw)
  To: netdev, dev; +Cc: pshelar, davem, kuba, Mark Gray

fix incorrect type in argument 1 (different address spaces)

../net/openvswitch/datapath.c:169:17: warning: incorrect type in argument 1 (different address spaces)
../net/openvswitch/datapath.c:169:17:    expected void const *
../net/openvswitch/datapath.c:169:17:    got struct dp_nlsk_pids [noderef] __rcu *upcall_portids

Found at: https://patchwork.kernel.org/project/netdevbpf/patch/20210630095350.817785-1-mark.d.gray@redhat.com/#24285159

Signed-off-by: Mark Gray <mark.d.gray@redhat.com>
---
 net/openvswitch/datapath.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c
index e6f0ae5618dd..67ad08320886 100644
--- a/net/openvswitch/datapath.c
+++ b/net/openvswitch/datapath.c
@@ -168,7 +168,7 @@ static void destroy_dp_rcu(struct rcu_head *rcu)
 	free_percpu(dp->stats_percpu);
 	kfree(dp->ports);
 	ovs_meters_exit(dp);
-	kfree(dp->upcall_portids);
+	kfree(rcu_dereference_raw(dp->upcall_portids));
 	kfree(dp);
 }
 
-- 
2.27.0


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

* Re: [PATCH net-next 0/3] openvswitch: per-cpu upcall patchwork issues
  2021-07-23 14:24 [PATCH net-next 0/3] openvswitch: per-cpu upcall patchwork issues Mark Gray
                   ` (2 preceding siblings ...)
  2021-07-23 14:24 ` [PATCH net-next 3/3] openvswitch: fix sparse warning incorrect type Mark Gray
@ 2021-07-27 11:00 ` patchwork-bot+netdevbpf
  3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-07-27 11:00 UTC (permalink / raw)
  To: Mark Gray; +Cc: netdev, dev, pshelar, davem, kuba

Hello:

This series was applied to netdev/net-next.git (refs/heads/master):

On Fri, 23 Jul 2021 10:24:11 -0400 you wrote:
> Some issues were raised by patchwork at:
> https://patchwork.kernel.org/project/netdevbpf/patch/20210630095350.817785-1-mark.d.gray@redhat.com/#24285159
> 
> Mark Gray (3):
>   openvswitch: update kdoc OVS_DP_ATTR_PER_CPU_PIDS
>   openvswitch: fix alignment issues
>   openvswitch: fix sparse warning incorrect type
> 
> [...]

Here is the summary with links:
  - [net-next,1/3] openvswitch: update kdoc OVS_DP_ATTR_PER_CPU_PIDS
    https://git.kernel.org/netdev/net-next/c/e4252cb66637
  - [net-next,2/3] openvswitch: fix alignment issues
    https://git.kernel.org/netdev/net-next/c/784dcfa56e04
  - [net-next,3/3] openvswitch: fix sparse warning incorrect type
    https://git.kernel.org/netdev/net-next/c/076999e46027

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-07-27 11:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-23 14:24 [PATCH net-next 0/3] openvswitch: per-cpu upcall patchwork issues Mark Gray
2021-07-23 14:24 ` [PATCH net-next 1/3] openvswitch: update kdoc OVS_DP_ATTR_PER_CPU_PIDS Mark Gray
2021-07-23 14:24 ` [PATCH net-next 2/3] openvswitch: fix alignment issues Mark Gray
2021-07-23 14:24 ` [PATCH net-next 3/3] openvswitch: fix sparse warning incorrect type Mark Gray
2021-07-27 11:00 ` [PATCH net-next 0/3] openvswitch: per-cpu upcall patchwork issues patchwork-bot+netdevbpf

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