On 20/12/17(Wed) 15:35, Alexander Bluhm wrote:
> On Wed, Dec 20, 2017 at 01:43:13PM +0100, Martin Pieuchot wrote:
> > [...] 
> > Flags are modified by the driver, not by the stack.  Some of them are
> > event immutable and might be better moved to a different field.
> 
> You have marked if_flags and if_xflags with an [N].  Reading happens
> everywhere in the stack.  Carp changes them often.  I think we have
> the kernel lock there.  Note that if_flags is short so access is
> not atomic.
> 
> Perhaps we should split the flags like I did with the sb_flagsintr
> a long time ago.  Changing them to int would be an easy first step.

That might be a good thing.  That's also why IFF_OACTIVE is no longer
a flag.

> > The goal is to stop grabbing the lock for per-driver ioctl(2).  This
> > would fix the problem that sleeping in if_ioctl() might block network
> > traffic for a long time.  That means the limit between driver and stack
> > fields have to be clear.  You just pointed out that `if_flags' has some
> > issues.
> 
> Thanks for the explanation.  The goal sounds reasonable.  But that
> means we have to check all the drivers and especially the pseudo-drivers'
> ioctl functions before unlocking (*ifp->if_ioctl)().

Pseudo-driver would be a second step.  We could (ironically) check for
IFXF_CLONED and still take the lock for pseudo-drivers.

Reply via email to