Re: Understanding mutual exclusion between rtnl_lock and rcu_read_lock

2017-02-05 Thread Cong Wang
On Fri, Feb 3, 2017 at 7:25 PM, Joel Cunningham wrote: > From the documentation in dev.c: > /* > * The @dev_base_head list is protected by @dev_base_lock and the rtnl > * semaphore. > * > * Pure readers hold dev_base_lock for reading, or rcu_read_lock() > * > * Writers must hold the rtnl sem

Re: Understanding mutual exclusion between rtnl_lock and rcu_read_lock

2017-02-03 Thread Joel Cunningham
> On Feb 3, 2017, at 3:40 PM, Cong Wang wrote: > > On Thu, Feb 2, 2017 at 6:05 PM, Joel Cunningham > wrote: >> >> In the case of SIOCSIFHWADDR, we get a pointer to the net_device through >> __dev_get_by_name() and then pass it to dev_set_mac_address() to modify >> through ndo_set_mac_addres

Re: Understanding mutual exclusion between rtnl_lock and rcu_read_lock

2017-02-03 Thread Cong Wang
On Thu, Feb 2, 2017 at 6:05 PM, Joel Cunningham wrote: > > In the case of SIOCSIFHWADDR, we get a pointer to the net_device through > __dev_get_by_name() and then pass it to dev_set_mac_address() to modify > through ndo_set_mac_address(). I didn’t see any uses of RCU APIs on the > writer side

Re: Understanding mutual exclusion between rtnl_lock and rcu_read_lock

2017-02-03 Thread Joel Cunningham
> On Feb 2, 2017, at 11:21 PM, Eric Dumazet wrote: > > On Thu, 2017-02-02 at 15:52 -0800, Alexander Duyck wrote: >> On Thu, Feb 2, 2017 at 3:47 PM, Joel Cunningham >> wrote: >>> Hi, >>> >>> I’m studying the synchronization used on different parts of struct >>> net_device and I’m struggling t

Re: Understanding mutual exclusion between rtnl_lock and rcu_read_lock

2017-02-02 Thread Eric Dumazet
On Thu, 2017-02-02 at 15:52 -0800, Alexander Duyck wrote: > On Thu, Feb 2, 2017 at 3:47 PM, Joel Cunningham > wrote: > > Hi, > > > > I’m studying the synchronization used on different parts of struct > > net_device and I’m struggling to understand how structure member > > modifications in dev_i

Re: Understanding mutual exclusion between rtnl_lock and rcu_read_lock

2017-02-02 Thread Joel Cunningham
> On Feb 2, 2017, at 5:52 PM, Alexander Duyck wrote: > > On Thu, Feb 2, 2017 at 3:47 PM, Joel Cunningham > wrote: >> Hi, >> >> I’m studying the synchronization used on different parts of struct >> net_device and I’m struggling to understand how structure member >> modifications in dev_ioctl

Re: Understanding mutual exclusion between rtnl_lock and rcu_read_lock

2017-02-02 Thread Alexander Duyck
On Thu, Feb 2, 2017 at 3:47 PM, Joel Cunningham wrote: > Hi, > > I’m studying the synchronization used on different parts of struct net_device > and I’m struggling to understand how structure member modifications in > dev_ioctl are synchronized. Getters in dev_ifsioc_locked() are only holding

Understanding mutual exclusion between rtnl_lock and rcu_read_lock

2017-02-02 Thread Joel Cunningham
Hi, I’m studying the synchronization used on different parts of struct net_device and I’m struggling to understand how structure member modifications in dev_ioctl are synchronized. Getters in dev_ifsioc_locked() are only holding rcu_read_lock() while setters in dev_ifsioc() are holding rtnl_lo