lkml.org 
[lkml]   [2019]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: [PATCH net-next 2/5] r8152: replace array with linking list for rx information
Date
Jakub Kicinski [mailto:jakub.kicinski@netronome.com]
[...]
> > static int rtl_stop_rx(struct r8152 *tp)
> > {
> > - int i;
> > + struct list_head *cursor, *next, tmp_list;
> > + unsigned long flags;
> > +
> > + INIT_LIST_HEAD(&tmp_list);
> >
> > - for (i = 0; i < RTL8152_MAX_RX; i++)
> > - usb_kill_urb(tp->rx_info[i].urb);
> > + /* The usb_kill_urb() couldn't be used in atomic.
> > + * Therefore, move the list of rx_info to a tmp one.
> > + * Then, list_for_each_safe could be used without
> > + * spin lock.
> > + */
>
> Would you mind explaining in a little more detail why taking the
> entries from the list for a brief period of time is safe?

Usually, it needs the spin lock before accessing the entry
of the list "tp->rx_info". However, for some reasons,
if we want to access the entry without spin lock, we
cloud move all entries to a local list temporally. Then,
we could make sure no other one could access the entries
included in the temporal local list.

For this case, when I move all entries to a temporal
local list, no other one could access them. Therefore,
I could access the entries included in the temporal local
list without spin lock.


Best Regards,
Hayes


\
 
 \ /
  Last update: 2019-08-07 06:35    [W:0.097 / U:0.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site