All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Assmann <sassmann@kpanic.de>
To: Jakub Kicinski <kuba@kernel.org>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
	anthony.l.nguyen@intel.com, lihong.yang@intel.com,
	jesse.brandeburg@intel.com, slawomirx.laba@intel.com,
	nicholas.d.nunley@intel.com
Subject: Re: [PATCH] iavf: fix locking of critical sections
Date: Tue, 16 Mar 2021 18:27:10 +0100	[thread overview]
Message-ID: <44b3f5f0-93f8-29e2-ab21-5fd7cc14c755@kpanic.de> (raw)
In-Reply-To: <20210316101443.56b87cf6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On 16.03.21 18:14, Jakub Kicinski wrote:
> On Tue, 16 Mar 2021 11:01:41 +0100 Stefan Assmann wrote:
>> To avoid races between iavf_init_task(), iavf_reset_task(),
>> iavf_watchdog_task(), iavf_adminq_task() as well as the shutdown and
>> remove functions more locking is required.
>> The current protection by __IAVF_IN_CRITICAL_TASK is needed in
>> additional places.
>>
>> - The reset task performs state transitions, therefore needs locking.
>> - The adminq task acts on replies from the PF in
>>   iavf_virtchnl_completion() which may alter the states.
>> - The init task is not only run during probe but also if a VF gets stuck
>>   to reinitialize it.
>> - The shutdown function performs a state transition.
>> - The remove function perorms a state transition and also free's
>>   resources.
>>
>> iavf_lock_timeout() is introduced to avoid waiting infinitely
>> and cause a deadlock. Rather unlock and print a warning.
>>
>> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
> 
> I personally think that the overuse of flags in Intel drivers brings
> nothing but trouble. At which point does it make sense to just add a
> lock / semaphore here rather than open code all this with no clear
> semantics? No code seems to just test the __IAVF_IN_CRITICAL_TASK flag,
> all the uses look like poor man's locking at a quick grep. What am I
> missing?
> 

Hi Jakub,

I agree with you that the locking could be done with other locking
mechanisms just as good. I didn't invent the current method so I'll let
Intel comment on that part, but I'd like to point out that what I'm
making use of is fixing what is currently in the driver.

Thanks!

  Stefan

WARNING: multiple messages have this Message-ID (diff)
From: Stefan Assmann <sassmann@kpanic.de>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH] iavf: fix locking of critical sections
Date: Tue, 16 Mar 2021 18:27:10 +0100	[thread overview]
Message-ID: <44b3f5f0-93f8-29e2-ab21-5fd7cc14c755@kpanic.de> (raw)
In-Reply-To: <20210316101443.56b87cf6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>

On 16.03.21 18:14, Jakub Kicinski wrote:
> On Tue, 16 Mar 2021 11:01:41 +0100 Stefan Assmann wrote:
>> To avoid races between iavf_init_task(), iavf_reset_task(),
>> iavf_watchdog_task(), iavf_adminq_task() as well as the shutdown and
>> remove functions more locking is required.
>> The current protection by __IAVF_IN_CRITICAL_TASK is needed in
>> additional places.
>>
>> - The reset task performs state transitions, therefore needs locking.
>> - The adminq task acts on replies from the PF in
>>   iavf_virtchnl_completion() which may alter the states.
>> - The init task is not only run during probe but also if a VF gets stuck
>>   to reinitialize it.
>> - The shutdown function performs a state transition.
>> - The remove function perorms a state transition and also free's
>>   resources.
>>
>> iavf_lock_timeout() is introduced to avoid waiting infinitely
>> and cause a deadlock. Rather unlock and print a warning.
>>
>> Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
> 
> I personally think that the overuse of flags in Intel drivers brings
> nothing but trouble. At which point does it make sense to just add a
> lock / semaphore here rather than open code all this with no clear
> semantics? No code seems to just test the __IAVF_IN_CRITICAL_TASK flag,
> all the uses look like poor man's locking at a quick grep. What am I
> missing?
> 

Hi Jakub,

I agree with you that the locking could be done with other locking
mechanisms just as good. I didn't invent the current method so I'll let
Intel comment on that part, but I'd like to point out that what I'm
making use of is fixing what is currently in the driver.

Thanks!

  Stefan

  reply	other threads:[~2021-03-16 17:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-16 10:01 [PATCH] iavf: fix locking of critical sections Stefan Assmann
2021-03-16 10:01 ` [Intel-wired-lan] " Stefan Assmann
2021-03-16 17:14 ` Jakub Kicinski
2021-03-16 17:14   ` [Intel-wired-lan] " Jakub Kicinski
2021-03-16 17:27   ` Stefan Assmann [this message]
2021-03-16 17:27     ` Stefan Assmann
2021-03-16 20:29     ` Jakub Kicinski
2021-03-16 20:29       ` [Intel-wired-lan] " Jakub Kicinski
2021-03-16 22:02       ` Jesse Brandeburg
2021-03-16 22:02         ` [Intel-wired-lan] " Jesse Brandeburg
2021-03-17  7:49         ` Stefan Assmann
2021-03-17  7:49           ` [Intel-wired-lan] " Stefan Assmann
2021-03-17 17:27           ` Laba, SlawomirX
2021-03-17 17:27             ` [Intel-wired-lan] " Laba, SlawomirX
2021-03-17 18:14             ` Stefan Assmann
2021-03-17 18:14               ` [Intel-wired-lan] " Stefan Assmann
2021-07-06  8:07 ` Jankowski, Konrad0
2021-07-06  8:07   ` Jankowski, Konrad0

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44b3f5f0-93f8-29e2-ab21-5fd7cc14c755@kpanic.de \
    --to=sassmann@kpanic.de \
    --cc=anthony.l.nguyen@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=jesse.brandeburg@intel.com \
    --cc=kuba@kernel.org \
    --cc=lihong.yang@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicholas.d.nunley@intel.com \
    --cc=slawomirx.laba@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.