A mirror of the official Linux kernel repository just in case
Go to file
David S. Miller fed07ef3b0 mlx5 tc flow handling for concurrent execution (Part 3)
This series includes updates to mlx5 ethernet and core driver:
 
 Vlad submits part 3 of 3 part series to allow TC flow handling
 for concurrent execution.
 
 Vlad says:
 ==========
 
 Structure mlx5e_neigh_hash_entry code that uses it are refactored in
 following ways:
 
 - Extend neigh_hash_entry with rcu and modify its users to always take
   reference to the structure when using it (neigh_hash_entry has already
   had atomic reference counter which was only used when scheduling neigh
   update on workqueue from atomic context of neigh update netevent).
 
 - Always use mlx5e_neigh_update_table->encap_lock when modifying neigh
   update hash table and list. Originally, this lock was only used to
   synchronize with netevent handler function, which is called from bh
   context and cannot use rtnl lock for synchronization. Use rcu read lock
   instead of encap_lock to lookup nhe in atomic context of netevent even
   handler function. Convert encap_lock to mutex to allow creating new
   neigh hash entries while holding it, which is safe to do because the
   lock is no longer used in atomic context.
 
 - Rcu-ify mlx5e_neigh_hash_entry->encap_list by changing operations on
   encap list to their rcu counterparts and extending encap structure
   with rcu_head to free the encap instances after rcu grace period. This
   allows fast traversal of list of encaps attached to nhe under rcu read
   lock protection.
 
 - Take encap_table_lock when accessing encap entries in neigh update and
   neigh stats update code to protect from concurrent encap entry
   insertion or removal.
 
 This approach leads to potential race condition when neigh update and
 neigh stats update code can access encap and flow entries that are not
 fully initialized or are being destroyed, or neigh can change state
 without updating encaps that are created concurrently. Prevent these
 issues by following changes in flow and encap initialization:
 
 - Extend mlx5e_tc_flow with 'init_done' completion. Modify neigh update
   to wait for both encap and flow completions to prevent concurrent
   access to a structure that is being initialized by tc.
 
 - Skip structures that failed during initialization: encaps with
   encap_id<0 and flows that don't have OFFLOADED flag set.
 
 - To ensure that no new flows are added to encap when it is being
   accessed by neigh update or neigh stats update, take encap_table_lock
   mutex.
 
 - To prevent concurrent deletion by tc, ensure that neigh update and
   neigh stats update hold references to encap and flow instances while
   using them.
 
 With changes presented in this patch set it is now safe to execute tc
 concurrently with neigh update and neigh stats update. However, these
 two workqueue tasks modify same flow "tmp_list" field to store flows
 with reference taken in temporary list to release the references after
 update operation finishes and should not be executed concurrently with
 each other.
 
 Last 3 patches of this series provide 3 new mlx5 trace points to track
 mlx5 tc requests and mlx5 neigh updates.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEGhZs6bAKwk/OTgTpSD+KveBX+j4FAl1dy9YACgkQSD+KveBX
 +j6kIAf+PgnUuqH/VJKRVqLDvCvHJMV+pmfnTUBJNJinkg2QTgRw2+0hKj5bJgit
 EOKxVbJEB4bC7FERjgTNY981fl2hK7/NQSWcWemhH7mwvnzAffpIuXMrK6Sw1uD9
 FHSeMCIRZLnaQi7oZYK7TEptChh4lsxVOMF9rLCAZ+ivbJFqYLOVRvo936FD91FN
 6gqzccyXY9srz9ideOZHxOLqGGFfDktw/Ijr5uyylVRSJFnj3zLhVAshNEYISHIE
 1a3cQQ9k7RmYCdlEcKxWO81doaNx3E9t110opqlDTm7ETOaqH/tOuMQDbABuVG0Q
 ELKnFwuPG2Hi26jcusasvMjYyYttXg==
 =0UbW
 -----END PGP SIGNATURE-----

Merge tag 'mlx5-updates-2019-08-21' of git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux

Saeed Mahameed says:

====================
mlx5 tc flow handling for concurrent execution (Part 3)

This series includes updates to mlx5 ethernet and core driver:

Vlad submits part 3 of 3 part series to allow TC flow handling
for concurrent execution.

Vlad says:
==========

Structure mlx5e_neigh_hash_entry code that uses it are refactored in
following ways:

- Extend neigh_hash_entry with rcu and modify its users to always take
  reference to the structure when using it (neigh_hash_entry has already
  had atomic reference counter which was only used when scheduling neigh
  update on workqueue from atomic context of neigh update netevent).

- Always use mlx5e_neigh_update_table->encap_lock when modifying neigh
  update hash table and list. Originally, this lock was only used to
  synchronize with netevent handler function, which is called from bh
  context and cannot use rtnl lock for synchronization. Use rcu read lock
  instead of encap_lock to lookup nhe in atomic context of netevent even
  handler function. Convert encap_lock to mutex to allow creating new
  neigh hash entries while holding it, which is safe to do because the
  lock is no longer used in atomic context.

- Rcu-ify mlx5e_neigh_hash_entry->encap_list by changing operations on
  encap list to their rcu counterparts and extending encap structure
  with rcu_head to free the encap instances after rcu grace period. This
  allows fast traversal of list of encaps attached to nhe under rcu read
  lock protection.

- Take encap_table_lock when accessing encap entries in neigh update and
  neigh stats update code to protect from concurrent encap entry
  insertion or removal.

This approach leads to potential race condition when neigh update and
neigh stats update code can access encap and flow entries that are not
fully initialized or are being destroyed, or neigh can change state
without updating encaps that are created concurrently. Prevent these
issues by following changes in flow and encap initialization:

- Extend mlx5e_tc_flow with 'init_done' completion. Modify neigh update
  to wait for both encap and flow completions to prevent concurrent
  access to a structure that is being initialized by tc.

- Skip structures that failed during initialization: encaps with
  encap_id<0 and flows that don't have OFFLOADED flag set.

- To ensure that no new flows are added to encap when it is being
  accessed by neigh update or neigh stats update, take encap_table_lock
  mutex.

- To prevent concurrent deletion by tc, ensure that neigh update and
  neigh stats update hold references to encap and flow instances while
  using them.

With changes presented in this patch set it is now safe to execute tc
concurrently with neigh update and neigh stats update. However, these
two workqueue tasks modify same flow "tmp_list" field to store flows
with reference taken in temporary list to release the references after
update operation finishes and should not be executed concurrently with
each other.

Last 3 patches of this series provide 3 new mlx5 trace points to track
mlx5 tc requests and mlx5 neigh updates.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-21 20:23:29 -07:00
arch Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-08-19 11:54:03 -07:00
block block: remove REQ_NOWAIT_INLINE 2019-08-15 11:09:16 -06:00
certs Revert "Merge tag 'keys-acl-20190703' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs" 2019-07-10 18:43:43 -07:00
crypto USB / PHY patches for 5.3-rc1 2019-07-11 15:40:06 -07:00
Documentation net/mlx5e: Add trace point for neigh update 2019-08-21 15:55:18 -07:00
drivers net/mlx5e: Add trace point for neigh update 2019-08-21 15:55:18 -07:00
fs for-5.3-rc4-tag 2019-08-18 09:51:48 -07:00
include net/mlx5e: Add tc flower tracepoints 2019-08-21 15:55:17 -07:00
init Merge branch 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-07-19 10:42:02 -07:00
ipc Merge branch 'work.mount0' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-07-19 10:42:02 -07:00
kernel Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-08-19 11:54:03 -07:00
lib Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-08-06 17:11:59 -07:00
LICENSES LICENSES: Rename other to deprecated 2019-05-03 06:34:32 -06:00
mm hugetlbfs: fix hugetlb page migration/fault race causing SIGBUS 2019-08-13 16:06:53 -07:00
net mac80211: minstrel_ht: improve rate probing for devices with static fallback 2019-08-21 11:10:13 +02:00
samples Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-08-19 11:54:03 -07:00
scripts Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-08-19 11:54:03 -07:00
security KEYS: trusted: allow module init if TPM is inactive or deactivated 2019-08-13 19:59:23 +03:00
sound sound fixes for 5.3-rc5 2019-08-16 08:49:45 -07:00
tools selftests: mlxsw: Add a test case for devlink-trap 2019-08-21 12:58:39 -07:00
usr kbuild: enable arch/s390/include/uapi/asm/zcrypt.h for uapi header test 2019-07-23 10:45:46 +02:00
virt KVM/arm fixes for 5.3, take #2 2019-08-09 16:53:50 +02:00
.clang-format Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2019-04-17 11:26:25 -07:00
.cocciconfig
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl 2019-05-16 10:53:40 -07:00
.gitattributes
.gitignore .gitignore: Add compilation database file 2019-07-27 12:18:19 +09:00
.mailmap MAINTAINERS: Update my email address 2019-07-22 14:57:50 +01:00
COPYING COPYING: use the new text with points to the license files 2018-03-23 12:41:45 -06:00
CREDITS Remove references to dead website. 2019-07-19 12:22:04 -07:00
Kbuild Kbuild updates for v5.1 2019-03-10 17:48:21 -07:00
Kconfig docs: kbuild: convert docs to ReST and rename to *.rst 2019-06-14 14:21:21 -06:00
MAINTAINERS Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-08-19 11:54:03 -07:00
Makefile Linux 5.3-rc5 2019-08-18 14:31:08 -07:00
README Drop all 00-INDEX files from Documentation/ 2018-09-09 15:08:58 -06:00

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.