tech-net archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: MP-safe ifnet with psz & psref



Yet another patch is here:
  http://www.netbsd.org/~ozaki-r/if_get.diff

This trial patch introduces if_get that returns an ifnet
object with holding psref and if_put that releases psref
of the ifnet object. The patch replaces ifnet_lock with
if_get/if_put and a simple mutex. The change fixes an
issue that normal ioctls and if_clone_destroy on the
same interface can run in parallel and it causes a panic.

Let me know if I'm missing something.

The patch just demonstrates fixing the issue though,
we have to replace ifunit with if_get and if_put anyway.
And also we need to apply psref to if_byindex as well.

  ozaki-r

On Tue, May 10, 2016 at 12:07 PM, Ryota Ozaki <ozaki-r%netbsd.org@localhost> wrote:
> On Thu, Apr 28, 2016 at 4:04 PM, Ryota Ozaki <ozaki-r%netbsd.org@localhost> wrote:
>> Hi,
>>
>> This proposal is the first step toward making interfaces
>> (struct ifnet) MP-safe; it applies psz and psref to ifnet
>> and ifnet_list to safely look up ifnets from ifnet_list
>> and safely remove an ifnet.
>>
>> Here is a patch:
>>   http://www.netbsd.org/~ozaki-r/psref-ifnet.diff
>
> I restored the original ifnet_list because the change broke
> netstat -i (kvm(3)). So we now maintain two ifnet lists while
> the original list is only added/removed elements and not
> referenced by say IFNET_FOREACH. It's redundant but its overhead
> is negligible and it's the easiest way to keep backward
> compatibility. Of course, ideally we should kill kvm(3) users
> and remove the original list, but it's not now, I think.
>
> Objection?
>
>   ozaki-r
>
>>
>> One concern is m_reclaim that can be run in hardware
>> interrupt and so the patch skips if_drain if it's
>> running in hardware interrupt because pserialize is
>> basically designed used in lwp or softint (and now
>> psref is used with IPL_SOFTNET). Is there a better
>> solution?
>>
>> And any other suggestions and comments would be
>> appreciated.
>>
>> Thanks,
>>   ozaki-r
>>
>> P.S. From today for ten days, I'll be unable to use
>> my main development machines, I wouldn't be able to
>> update and test patches reflected your feedbacks enough.


Home | Main Index | Thread Index | Old Index