Subject: Re: [PATCH net] sky2: Do not deadlock on sky2_hw_down

From: Stephen Hemminger <[email-masked]>
Date: Fri, 26 May 2017 08:43:08 -0700

On Thu, 25 May 2017 23:58:30 -0400 (EDT)
David Miller <[email-masked]> wrote:

> From: Stephen Hemminger <[email-masked]>
> Date: Thu, 25 May 2017 15:05:02 -0700
> 
> > Ok, the issue is that lockdep is being stupid and thinking that
> > seqcount's behave like locks.  
> 
> Well.. they do.  That's why they have that annotation.

Your right, but it has some lock like properties because
the seqcount's assumption about odd and even values.

Lockdep is reporting that accessing a sequence count with softirq disabled
and in another case with softirq enabled is a problem. 

Potential race theoretical race:

 seqcount_begin()             ++count
  ...
		---> IRQ
                --->   Soft IRQ
                                    seqcount_begin()  ++count
					update stats
				    seqcount_end() ++count
      Anything doing seqcount read during this softirq 
      will spin thinking still in critical section

But for this case of statistics, there is nothing reading statistics in softirq
context so it can't happen. Lockdep needs to be smarter to know that.
Simplest way to shut this up is to just disable softirq during the cleanup.