Skip to content
Snippets Groups Projects
Select Git revision
  • 43815482370c510c569fd18edb57afcb0fa8cab6
  • add-vdpu381-and-383-to-rkvdec
  • add-rkvdec2-driver-vdpu383-hevc
  • add-rkvdec2-driver-vdpu383
  • add-rkvdec2-driver-hevc
  • rkvdec-mov-to-structs
  • av1-fix-postproc-leak
  • add-rkvdec2-driver-iommu-422-10bits
  • patch-queue/jamba/trixie
  • hdmi-fix-1080p-rock4d-6.11
  • upstreaming/rk3576-rock4d-spi-v1
  • upstreaming/rk3576-rock4d-support-v5
  • upstreaming/rk3588-hdmi-audio-6
  • upstreaming/rk3576-rock4d-support-v3
  • upstreaming/rk3576-rock4d-support-v1
  • upstreaming/rk3576-rock4d-support
  • add-rkvdec2-driver-iommu
  • upstream/rk3576-rock-4d
  • rk3588-hdmi-audio-2
  • fix-rk3588-i2s-tdm-clocks
  • rk3576-vop2-v4
  • v6.3
  • v6.3-rc1
  • v6.2-rc1
  • v6.0-rc1
  • v5.19-rc3
  • v5.19-rc2
  • v5.19-rc1
  • v5.18
  • v5.18-rc7
  • v5.18-rc6
  • v5.18-rc5
  • v5.18-rc4
  • v5.18-rc3
  • v5.18-rc2
  • v5.18-rc1
  • v5.17
  • v5.17-rc8
  • v5.17-rc7
  • v5.17-rc6
  • v5.17-rc5
41 results

af_unix.c

Blame
  • Forked from hardware-enablement / Rockchip upstream enablement efforts / linux
    Source project has a limited visibility.
    • Eric Dumazet's avatar
      43815482
      net: sock_def_readable() and friends RCU conversion · 43815482
      Eric Dumazet authored
      
      sk_callback_lock rwlock actually protects sk->sk_sleep pointer, so we
      need two atomic operations (and associated dirtying) per incoming
      packet.
      
      RCU conversion is pretty much needed :
      
      1) Add a new structure, called "struct socket_wq" to hold all fields
      that will need rcu_read_lock() protection (currently: a
      wait_queue_head_t and a struct fasync_struct pointer).
      
      [Future patch will add a list anchor for wakeup coalescing]
      
      2) Attach one of such structure to each "struct socket" created in
      sock_alloc_inode().
      
      3) Respect RCU grace period when freeing a "struct socket_wq"
      
      4) Change sk_sleep pointer in "struct sock" by sk_wq, pointer to "struct
      socket_wq"
      
      5) Change sk_sleep() function to use new sk->sk_wq instead of
      sk->sk_sleep
      
      6) Change sk_has_sleeper() to wq_has_sleeper() that must be used inside
      a rcu_read_lock() section.
      
      7) Change all sk_has_sleeper() callers to :
        - Use rcu_read_lock() instead of read_lock(&sk->sk_callback_lock)
        - Use wq_has_sleeper() to eventually wakeup tasks.
        - Use rcu_read_unlock() instead of read_unlock(&sk->sk_callback_lock)
      
      8) sock_wake_async() is modified to use rcu protection as well.
      
      9) Exceptions :
        macvtap, drivers/net/tun.c, af_unix use integrated "struct socket_wq"
      instead of dynamically allocated ones. They dont need rcu freeing.
      
      Some cleanups or followups are probably needed, (possible
      sk_callback_lock conversion to a spinlock for example...).
      
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      43815482
      History
      net: sock_def_readable() and friends RCU conversion
      Eric Dumazet authored
      
      sk_callback_lock rwlock actually protects sk->sk_sleep pointer, so we
      need two atomic operations (and associated dirtying) per incoming
      packet.
      
      RCU conversion is pretty much needed :
      
      1) Add a new structure, called "struct socket_wq" to hold all fields
      that will need rcu_read_lock() protection (currently: a
      wait_queue_head_t and a struct fasync_struct pointer).
      
      [Future patch will add a list anchor for wakeup coalescing]
      
      2) Attach one of such structure to each "struct socket" created in
      sock_alloc_inode().
      
      3) Respect RCU grace period when freeing a "struct socket_wq"
      
      4) Change sk_sleep pointer in "struct sock" by sk_wq, pointer to "struct
      socket_wq"
      
      5) Change sk_sleep() function to use new sk->sk_wq instead of
      sk->sk_sleep
      
      6) Change sk_has_sleeper() to wq_has_sleeper() that must be used inside
      a rcu_read_lock() section.
      
      7) Change all sk_has_sleeper() callers to :
        - Use rcu_read_lock() instead of read_lock(&sk->sk_callback_lock)
        - Use wq_has_sleeper() to eventually wakeup tasks.
        - Use rcu_read_unlock() instead of read_unlock(&sk->sk_callback_lock)
      
      8) sock_wake_async() is modified to use rcu protection as well.
      
      9) Exceptions :
        macvtap, drivers/net/tun.c, af_unix use integrated "struct socket_wq"
      instead of dynamically allocated ones. They dont need rcu freeing.
      
      Some cleanups or followups are probably needed, (possible
      sk_callback_lock conversion to a spinlock for example...).
      
      Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    af_unix.c 52.47 KiB
    /*
     * NET4:	Implementation of BSD Unix domain sockets.
     *
     * Authors:	Alan Cox, <alan@lxorguk.ukuu.org.uk>
     *
     *		This program is free software; you can redistribute it and/or
     *		modify it under the terms of the GNU General Public License
     *		as published by the Free Software Foundation; either version
     *		2 of the License, or (at your option) any later version.
     *
     * Fixes:
     *		Linus Torvalds	:	Assorted bug cures.
     *		Niibe Yutaka	:	async I/O support.
     *		Carsten Paeth	:	PF_UNIX check, address fixes.
     *		Alan Cox	:	Limit size of allocated blocks.
     *		Alan Cox	:	Fixed the stupid socketpair bug.
     *		Alan Cox	:	BSD compatibility fine tuning.
     *		Alan Cox	:	Fixed a bug in connect when interrupted.
     *		Alan Cox	:	Sorted out a proper draft version of
     *					file descriptor passing hacked up from
     *					Mike Shaver's work.
     *		Marty Leisner	:	Fixes to fd passing
     *		Nick Nevin	:	recvmsg bugfix.
     *		Alan Cox	:	Started proper garbage collector
     *		Heiko EiBfeldt	:	Missing verify_area check
     *		Alan Cox	:	Started POSIXisms
     *		Andreas Schwab	:	Replace inode by dentry for proper
     *					reference counting
     *		Kirk Petersen	:	Made this a module
     *	    Christoph Rohland	:	Elegant non-blocking accept/connect algorithm.
     *					Lots of bug fixes.
     *	     Alexey Kuznetosv	:	Repaired (I hope) bugs introduces
     *					by above two patches.
     *	     Andrea Arcangeli	:	If possible we block in connect(2)
     *					if the max backlog of the listen socket
     *					is been reached. This won't break
     *					old apps and it will avoid huge amount
     *					of socks hashed (this for unix_gc()
     *					performances reasons).
     *					Security fix that limits the max
     *					number of socks to 2*max_files and
     *					the number of skb queueable in the
     *					dgram receiver.
     *		Artur Skawina   :	Hash function optimizations
     *	     Alexey Kuznetsov   :	Full scale SMP. Lot of bugs are introduced 8)
     *	      Malcolm Beattie   :	Set peercred for socketpair
     *	     Michal Ostrowski   :       Module initialization cleanup.
     *	     Arnaldo C. Melo	:	Remove MOD_{INC,DEC}_USE_COUNT,
     *	     				the core infrastructure is doing that
     *	     				for all net proto families now (2.5.69+)
     *
     *
     * Known differences from reference BSD that was tested:
     *
     *	[TO FIX]
     *	ECONNREFUSED is not returned from one end of a connected() socket to the
     *		other the moment one end closes.
     *	fstat() doesn't return st_dev=0, and give the blksize as high water mark
     *		and a fake inode identifier (nor the BSD first socket fstat twice bug).
     *	[NOT TO FIX]
     *	accept() returns a path name even if the connecting socket has closed
     *		in the meantime (BSD loses the path and gives up).
     *	accept() returns 0 length path for an unbound connector. BSD returns 16
     *		and a null first byte in the path (but not for gethost/peername - BSD bug ??)
     *	socketpair(...SOCK_RAW..) doesn't panic the kernel.
     *	BSD af_unix apparently has connect forgetting to block properly.
     *		(need to check this with the POSIX spec in detail)
     *
     * Differences from 2.0.0-11-... (ANK)
     *	Bug fixes and improvements.