Skip to content

Commit df15267

Browse files
author
Paolo Abeni
committed
Merge branch 'dibs-direct-internal-buffer-sharing'
Alexandra Winter says: ==================== dibs - Direct Internal Buffer Sharing This series introduces a generic abstraction of existing components like: - the s390 specific ISM device (Internal Shared Memory), - the SMC-D loopback mechanism (Shared Memory Communication - Direct) - the client interface of the SMC-D module to the transport devices This generic shim layer can be extended with more devices, more clients and more features in the future. This layer is called 'dibs' for Direct Internal Buffer Sharing based on the common scheme that these mechanisms enable controlled sharing of memory buffers within some containing entity such as a hypervisor or a Linux instance. Benefits: - Cleaner separation of ISM and SMC-D functionality - simpler and less module dependencies - Clear interface definition. - Extendable for future devices and clients. An overview was given at the Netdev 0x19 conference, recordings and slides are available [1]. Background / Status quo: ------------------------ Currently s390 hardware provides virtual PCI ISM devices (Internal Shared Memory). Their driver is in drivers/s390/net/ism_drv.c. The main user is SMC-D (net/smc). The ism driver offers a client interface so other users/protocols can also use them, but it is still heavily intermingled with the smc code. Namely, the ism module cannot be used without the smc module, which feels artificial. There is ongoing work to extend the ISM concept of shared buffers that can be accessed directly by another instance on the same hardware: [2] proposed a loopback interface (ism_lo), that can be used on non-s390 architectures (e.g. between containers or to test SMC-D). A minimal implementation went upstream with [3]: ism_lo currently is a part of the smc protocol and rather hidden. [4] proposed a virtio definition of ism (ism_virtio) that can be used between kvm guests. We will shortly send an RFC for an dibs client that uses dibs as transport for TTY. Concept: -------- Create a shim layer in net/dibs that contains common definitions and code for all dibs devices and all dibs clients. Any device or client module only needs to depend on this dibs layer module and any device or client code only needs to include the definitions in include/linux/dibs.h. The name dibs was chosen to clearly distinguish it from the existing s390 ism devices. And to emphasize that it is not about sharing whole memory regions with anybody, but dedicating single buffers for another system. Implementation: --------------- The end result of this series is: A dibs shim layer with - One dibs client: smc-d - Two dibs device drivers: ism and dibs-loopback - Everything prepared to add more clients and more device drivers. Patches 1-2 contain some issues that were found along the way. They make sense on their own, but also enable a better structured dibs series. There are three components that exist today: a) smc module (especially SMC-D functionality, which is an ism client today) b) ism device driver (supports multiple ism clients today) c) smc-loopback (integrated with smc today) In order to preserve existing functionality at each step, these are not moved to dibs layer by component, instead: - the dibs layer is established in parallel to existing code [patches 3-6] - then some service functions are moved to the dibs layer [patches 7-12] - the actual data movement is moved to the dibs layer [patch 13] - and last event handling is moved to the dibs layer [patch 14] Future: ------- Items that are not part of this patchset but can be added later: - dynamically add or remove dibs_loopback. That will be allow for simple testing of add_dev()/del_dev() - handle_irq(): Call clients without interrupt context. e.g using threaded interrupts. I left this for a follow-on, because it includes conceptual changes for the smcd receive code. - Any improvements of locking scopes. I mainly moved some of the the existing locks to dibs layer. I have the feeling there is room for improvements. - The device drivers should not loop through the client array - dibs_dev_op.*_dmb() functions reveal unnecessary details of the internal dmb struct to the clients - Check whether client calls to dibs_dev_ops should be replaced by interface functions that provide additional value - Check whether device driver calls to dibs_client_ops should be replaced by interface functions that provide additional value. Link: [1] https://netdevconf.info/0x19/sessions/talk/communication-via-internal-shared-memory-ism-time-to-open-up.html Link: [2] https://lore.kernel.org/netdev/[email protected]/ Link: [3] https://lore.kernel.org/linux-kernel//[email protected]/ Link: [4] https://groups.oasis-open.org/communities/community-home/digestviewer/viewthread?GroupId=3973&MessageKey=c060ecf9-ea1a-49a2-9827-c92f0e6447b2&CommunityKey=2f26be99-3aa1-48f6-93a5-018dce262226&hlmlt=VT ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents 6e2f148 + a612dbe commit df15267

29 files changed

+1645
-1085
lines changed

MAINTAINERS

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7132,6 +7132,13 @@ L: [email protected]
71327132
S: Maintained
71337133
F: drivers/gpio/gpio-gpio-mm.c
71347134

7135+
DIBS (DIRECT INTERNAL BUFFER SHARING)
7136+
M: Alexandra Winter <[email protected]>
7137+
7138+
S: Supported
7139+
F: drivers/dibs/
7140+
F: include/linux/dibs.h
7141+
71357142
DIGITEQ AUTOMOTIVE MGB4 V4L2 DRIVER
71367143
M: Martin Tuma <[email protected]>
71377144
@@ -17573,7 +17580,6 @@ F: include/linux/fddidevice.h
1757317580
F: include/linux/hippidevice.h
1757417581
F: include/linux/if_*
1757517582
F: include/linux/inetdevice.h
17576-
F: include/linux/ism.h
1757717583
F: include/linux/netdev*
1757817584
F: include/linux/platform_data/wiznet.h
1757917585
F: include/uapi/linux/cn_proc.h
@@ -22230,7 +22236,6 @@ L: [email protected]
2223022236
2223122237
S: Supported
2223222238
F: drivers/s390/net/
22233-
F: include/linux/ism.h
2223422239

2223522240
S390 PCI SUBSYSTEM
2223622241
M: Niklas Schnelle <[email protected]>

arch/s390/configs/debug_defconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,10 @@ CONFIG_UNIX=y
120120
CONFIG_UNIX_DIAG=m
121121
CONFIG_XFRM_USER=m
122122
CONFIG_NET_KEY=m
123+
CONFIG_DIBS=y
124+
CONFIG_DIBS_LO=y
125+
CONFIG_SMC=m
123126
CONFIG_SMC_DIAG=m
124-
CONFIG_SMC_LO=y
125127
CONFIG_INET=y
126128
CONFIG_IP_MULTICAST=y
127129
CONFIG_IP_ADVANCED_ROUTER=y

arch/s390/configs/defconfig

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,10 @@ CONFIG_UNIX=y
111111
CONFIG_UNIX_DIAG=m
112112
CONFIG_XFRM_USER=m
113113
CONFIG_NET_KEY=m
114+
CONFIG_DIBS=y
115+
CONFIG_DIBS_LO=y
116+
CONFIG_SMC=m
114117
CONFIG_SMC_DIAG=m
115-
CONFIG_SMC_LO=y
116118
CONFIG_INET=y
117119
CONFIG_IP_MULTICAST=y
118120
CONFIG_IP_ADVANCED_ROUTER=y

drivers/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,5 @@ obj-$(CONFIG_DRM_ACCEL) += accel/
195195
obj-$(CONFIG_CDX_BUS) += cdx/
196196
obj-$(CONFIG_DPLL) += dpll/
197197

198+
obj-$(CONFIG_DIBS) += dibs/
198199
obj-$(CONFIG_S390) += s390/

drivers/dibs/Kconfig

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
config DIBS
3+
tristate "DIBS support"
4+
default n
5+
help
6+
Direct Internal Buffer Sharing (DIBS)
7+
A communication method that uses common physical (internal) memory
8+
for synchronous direct access into a remote buffer.
9+
10+
Select this option to provide the abstraction layer between
11+
dibs devices and dibs clients like the SMC protocol.
12+
The module name is dibs.
13+
14+
config DIBS_LO
15+
bool "intra-OS shortcut with dibs loopback"
16+
depends on DIBS
17+
default n
18+
help
19+
DIBS_LO enables the creation of an software-emulated dibs device
20+
named lo which can be used for transferring data when communication
21+
occurs within the same OS. This helps in convenient testing of
22+
dibs clients, since dibs loopback is independent of architecture or
23+
hardware.

drivers/dibs/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# DIBS class module
4+
#
5+
6+
dibs-y += dibs_main.o
7+
obj-$(CONFIG_DIBS) += dibs.o
8+
dibs-$(CONFIG_DIBS_LO) += dibs_loopback.o

0 commit comments

Comments
 (0)