netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Tantilov, Emil S" <emil.s.tantilov@intel.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Jacob Keller <jacob.e.keller@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	"Paolo Abeni" <pabeni@redhat.com>,
	Pavan Kumar Linga <pavan.kumar.linga@intel.com>,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	Willem de Bruijn <willemb@google.com>,
	Sridhar Samudrala <sridhar.samudrala@intel.com>,
	"Phani Burra" <phani.r.burra@intel.com>,
	Piotr Kwapulinski <piotr.kwapulinski@intel.com>,
	Simon Horman <horms@kernel.org>,
	Radoslaw Tyl <radoslawx.tyl@intel.com>,
	Jedrzej Jagielski <jedrzej.jagielski@intel.com>,
	Mateusz Polchlopek <mateusz.polchlopek@intel.com>,
	Anton Nadezhdin <anton.nadezhdin@intel.com>,
	Konstantin Ilichev <konstantin.ilichev@intel.com>,
	Milena Olech <milena.olech@intel.com>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,
	Joshua Hay <joshua.a.hay@intel.com>,
	Aleksandr Loktionov <aleksandr.loktionov@intel.com>,
	Chittim Madhu <madhu.chittim@intel.com>,
	Samuel Salin <Samuel.salin@intel.com>
Subject: Re: [PATCH net 3/8] idpf: fix possible race in idpf_vport_stop()
Date: Mon, 6 Oct 2025 17:07:26 -0700	[thread overview]
Message-ID: <048833d9-01f5-438d-a3fa-354a008ebbd3@intel.com> (raw)
In-Reply-To: <20251006102659.595825fe@kernel.org>



On 10/6/2025 10:26 AM, Jakub Kicinski wrote:
> On Mon, 6 Oct 2025 07:49:32 -0700 Tantilov, Emil S wrote:
>>> Argh, please stop using the flag based state machines. They CANNOT
>>> replace locking. If there was proper locking in place it wouldn't
>>> have mattered when we clear the flag.
>>
>> This patch is resolving a bug in the current logic of how the flag is
>> used (not being atomic and not being cleared properly). I don't think
>> there is an existing lock in place to address this issue, though we are
>> looking to refactor the code over time to remove and/or limit how these
>> flags are used.
> 
> Can you share more details about the race? If there is no lock in place
> there's always the risk that:
> 
>    CPU 0                         CPU 1
>   idpf_vport_stop()             whatever()
>                                   if (test_bit(UP))
>                                    # sees true
>                                  # !< long IRQ arrives
>   test_and_clear(UP)
>     ...
>     all the rest
>     ...
>                                  # > long IRQ ends
>                                  proceed but UP isn't really set any more
> 

The specific case I was targeting with this patch is for when both
idpf_vport_stop() and idpf_addr_unsync(), called via set_rx_mode attempt
to delete the MAC filters. At least in my testing I have not seen a case
where the set_rx_mode callback will happen before idpf_vport_stop(). I
am assuming due to userspace reacting to the removal of the netdevs.

            rmmod-6089    [021] .....  3521.291596: idpf_remove 
<-pci_device_remove
            rmmod-6089    [021] .....  3521.292686: idpf_vport_stop 
<-idpf_vport_dealloc
  systemd-resolve-1633    [022] b..1.  3521.295320: idpf_set_rx_mode 
<-dev_mc_del
  systemd-resolve-1633    [022] b..1.  3521.295338: idpf_addr_unsync 
<-__hw_addr_sync_dev
  systemd-resolve-1633    [022] b..1.  3521.295339: idpf_del_mac_filter 
<-idpf_addr_unsync
  systemd-resolve-1633    [022] b..1.  3521.295450: idpf_set_rx_mode 
<-dev_mc_del
  systemd-resolve-1633    [022] b..1.  3521.295451: idpf_addr_unsync 
<-__hw_addr_sync_dev
  systemd-resolve-1633    [022] b..1.  3521.295451: idpf_del_mac_filter 
<-idpf_addr_unsync
            rmmod-6089    [002] .....  3521.934980: idpf_vport_stop 
<-idpf_vport_dealloc
  systemd-resolve-1633    [022] b..1.  3522.297299: idpf_set_rx_mode 
<-dev_mc_del
  systemd-resolve-1633    [022] b..1.  3522.297316: idpf_addr_unsync 
<-__hw_addr_sync_dev
  systemd-resolve-1633    [022] b..1.  3522.297317: idpf_del_mac_filter 
<-idpf_addr_unsync
   kworker/u261:2-3157    [037] ...1.  3522.297931: 
idpf_mac_filter_async_handler: Received invalid MAC filter payload (op 
536) (len 0)
            rmmod-6089    [020] .....  3522.573251: idpf_vport_stop 
<-idpf_vport_dealloc
            rmmod-6089    [002] .....  3523.229936: idpf_vport_stop 
<-idpf_vport_dealloc
  systemd-resolve-1633    [022] b..1.  3523.311435: idpf_set_rx_mode 
<-dev_mc_del
  systemd-resolve-1633    [022] b..1.  3523.311452: idpf_addr_unsync 
<-__hw_addr_sync_dev
  systemd-resolve-1633    [022] b..1.  3523.311453: idpf_del_mac_filter 
<-idpf_addr_unsync




  reply	other threads:[~2025-10-07  0:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-02  0:14 [PATCH net 0/8] Intel Wired LAN Driver Updates 2025-10-01 (idpf, ixgbe, ixgbevf) Jacob Keller
2025-10-02  0:14 ` [PATCH net 1/8] idpf: cleanup remaining SKBs in PTP flows Jacob Keller
2025-10-02  0:14 ` [PATCH net 2/8] idpf: convert vport state to bitmap Jacob Keller
2025-10-02  0:14 ` [PATCH net 3/8] idpf: fix possible race in idpf_vport_stop() Jacob Keller
2025-10-03 17:43   ` Jakub Kicinski
2025-10-06 14:49     ` Tantilov, Emil S
2025-10-06 17:26       ` Jakub Kicinski
2025-10-07  0:07         ` Tantilov, Emil S [this message]
2025-10-08 21:41           ` Jacob Keller
2025-10-13 18:13             ` Jakub Kicinski
2025-10-22 22:49               ` Tantilov, Emil S
2025-10-02  0:14 ` [PATCH net 4/8] ixgbevf: fix getting link speed data for E610 devices Jacob Keller
2025-10-02  0:14 ` [PATCH net 5/8] ixgbe: handle IXGBE_VF_GET_PF_LINK_STATE mailbox operation Jacob Keller
2025-10-02  0:14 ` [PATCH net 6/8] ixgbevf: fix mailbox API compatibility by negotiating supported features Jacob Keller
2025-10-02  0:14 ` [PATCH net 7/8] ixgbe: handle IXGBE_VF_FEATURES_NEGOTIATE mbox cmd Jacob Keller
2025-10-02  0:14 ` [PATCH net 8/8] ixgbe: fix too early devlink_free() in ixgbe_remove() Jacob Keller
2025-10-03 17:42 ` [PATCH net 0/8] Intel Wired LAN Driver Updates 2025-10-01 (idpf, ixgbe, ixgbevf) Jakub Kicinski
2025-10-04  0:58   ` Jacob Keller
2025-10-06 15:27 ` Alexander Lobakin
2025-10-06 21:59   ` Jacob Keller
2025-10-06 23:58   ` Jacob Keller

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=048833d9-01f5-438d-a3fa-354a008ebbd3@intel.com \
    --to=emil.s.tantilov@intel.com \
    --cc=Samuel.salin@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=aleksandr.loktionov@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anton.nadezhdin@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jedrzej.jagielski@intel.com \
    --cc=joshua.a.hay@intel.com \
    --cc=konstantin.ilichev@intel.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madhu.chittim@intel.com \
    --cc=mateusz.polchlopek@intel.com \
    --cc=milena.olech@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.kumar.linga@intel.com \
    --cc=phani.r.burra@intel.com \
    --cc=piotr.kwapulinski@intel.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=radoslawx.tyl@intel.com \
    --cc=sridhar.samudrala@intel.com \
    --cc=willemb@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).