lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sat, 28 Jan 2012 13:12:38 +0100
From:	Michał Mirosław <mirqus@...il.com>
To:	Francois Romieu <romieu@...zoreil.com>
Cc:	davem@...emloft.net, netdev@...r.kernel.org,
	Hayes Wang <hayeswang@...ltek.com>
Subject: Re: [PATCH net-next 7/7] r8169: remove work from irq handler.

W dniu 28 stycznia 2012 12:11 użytkownik Francois Romieu
<romieu@...zoreil.com> napisał:
> Michał Mirosław <mirqus@...il.com> :
>> 2012/1/27 Francois Romieu <romieu@...zoreil.com>:
> [...]
>> > +static void rtl_schedule_task(struct rtl8169_private *tp, enum rtl_flag flag)
>> > +{
>> > +       spin_lock(&tp->lock);
>> > +       if (!test_and_set_bit(flag, tp->wk.flags))
>> > +               schedule_work(&tp->wk.work);
>> > +       spin_unlock(&tp->lock);
>> > +}
>> > +
>> > +static void rtl_schedule_task_bh(struct rtl8169_private *tp, enum rtl_flag flag)
>> > +{
>> > +       local_bh_disable();
>> > +       rtl_schedule_task(tp, flag);
>> > +       local_bh_enable();
>> > +}
>> > +
>>
>> It might be enough to do:
>>
>> rtl_schedule_task():
>>
>> set_bit(flag, tp->wk.flags);
>> schedule_work(&tp->wk.work);
>>
>> This will guarantee that the work is done at least once (twice in
>> unlikely case that it was being executed just before schedule_work()).
>
> If I understand correctly this remark and the following ones, you are
> suggesting to completely avoid the lock to access the bitfield ?

Yes. In case of clearing the enable flag (regardless if you move it
from separate bool to the bitmap) mutex needed though.

BTW, on resume, are the flags always cleared?

> [...]
>> > +/*
>> > + * Workqueue context.
>> > + */
>> > +static void rtl_slow_event_work(struct rtl8169_private *tp)
>> > +{
> [...]
>> > +       if (unlikely(status & RxFIFOOver)) {
>> > +               switch (tp->mac_version) {
>> > +               /* Work around for rx fifo overflow */
>> > +               case RTL_GIGA_MAC_VER_11:
>> > +                       netif_stop_queue(dev);
>> > +                       rtl_schedule_task_bh(tp, RTL_FLAG_TASK_RESET_PENDING);
>>
>> Since this is running from the same task it schedules, it should be
>> enough to set_bit() and ensure that rtl_slow_event_work() is first on
>> the list in rtl_task().
> I saw "first in list" as mildly maintenable. Ok, I buy it if nobody complains.

You should add a comment here and in rtl_task(), of course.

Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ