mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Aaron Ma <aaron.ma@canonical.com>
Cc: Dan Nowlin <dan.nowlin@intel.com>,
	Brett Creeley <brett.creeley@intel.com>,
	"moderated list:INTEL ETHERNET DRIVERS"
	<intel-wired-lan@lists.osuosl.org>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	Alexander Lobakin <aleksander.lobakin@intel.com>,
	Richard Cochran <richardcochran@gmail.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 3/5] ice: scope global configuration lock to the adapter
Date: Thu, 22 Oct 2026 11:19:24 -0700	[thread overview]
Message-ID: <1232046a-bd51-4dfb-9eac-720e1a943dbf@intel.com> (raw)
In-Reply-To: <ac4fb583-4721-48ec-bea5-ee4e7380f606@intel.com>

On 10/22/2026 4:10 AM, Przemek Kitszel wrote:
> On 10/19/26 12:51 PM, Aaron Ma wrote:
>> ice_global_cfg_lock_sw is a module-global mutex, so a package download
>> on one E810 adapter blocks Admin Queue commands on unrelated adapters in
>> the same system. In addition, the mutex is acquired only after firmware
>> grants the Global Configuration Lock and dropped before firmware
>> releases it, while the opcode exemption list in ice_aq_send_cmd() does
>> not check whether the caller is the lock owner. Non-owning PFs on the
>> same adapter can therefore submit exempted Admin Queue commands or
>> sideband requests while another PF holds firmware ownership.
> 
> This is not a bug to allow exempted commands, does not matter from which
> PF.
> 

Its not strictly a "bug" but I do think it makes sense to only allow a
single PF to send the set of configuration commands.

>>
>> Move the software mutex to struct ice_adapter and record the owning task
>> across the entire Global Configuration Lock acquisition and release
>> sequence, including the core reset path in ice_cfg_tx_topo(). In
> 
> this is fine,
> would be better to not track mutex holder
> 

Yea. I'm struggling to understand what the reason we need to track the
owning task vs just having the lock.

>> ice_aq_send_cmd(), require non-owning tasks to wait on the adapter mutex
>> while allowing the owning task to issue the permitted configuration
>> commands. 
> 
> 
>> Route the Admin Queue fallback in ice_sbq_send_cmd() through
>> ice_aq_send_cmd() as well.
> 
> perhaps this should be separate commit?
> 

That might make it easier to review.. OTOH we also have been limited in
how many patches we can get merged, so I could see the pressure for
reducing the number where it reasonably makes sense...

>>
>> This patch depends on the previous patch in this series.
>>
>> Fixes: c76488109616 ("ice: Implement Dynamic Device Personalization
>> (DDP) download")
>> Signed-off-by: Aaron Ma <aaron.ma@canonical.com>
> 
> 
>> @@ -1895,17 +1894,24 @@ ice_aq_send_cmd(struct ice_hw *hw, struct
>> libie_aq_desc *desc, void *buf,
>>           u16 buf_size, struct ice_sq_cd *cd)
>>   {
>>       struct libie_aqc_req_res *cmd = libie_aq_raw(desc);
>> -    bool lock_acquired = false;
>> -    int status;
>> +    struct ice_pf *pf = hw->back;
>> +    struct ice_adapter *adapter = pf->adapter;
> 
> RCT violation
> 
>> +
>> +    if (READ_ONCE(adapter->global_cfg_owner) != current) {
>> +        guard(mutex)(&adapter->global_cfg_lock);
> 
> no guard()()
> especially here scoped_guard() fits nicely
> 

Yes. guard() is not well liked by the maintainers, and I believe
recently they have strengthened their preference against its use, but
its at least documented as discouraged:

https://lore.kernel.org/netdev/20240829152025.3203577-1-kuba@kernel.org/

I thought recently there were some high profile issues caused by __free
and/or guard() that strengthened this to a hard no but I can't find the
emails.

Please stick to scoped_guard or regular bare lock/unlock where
scoped_guard does not provide much benefit.

  reply	other threads:[~2026-10-22 18:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-19 10:51 [PATCH 0/5] ice: fix reset and suspend paths Aaron Ma
2026-10-19 10:51 ` [PATCH 1/5] ice: check the full PF reset polling limit Aaron Ma
2026-10-19 11:28   ` Temerkhanov, Sergey
2026-10-19 11:30   ` Przemek Kitszel
2026-10-19 10:51 ` [PATCH 2/5] ice: retain the adapter throughout hardware initialization and teardown Aaron Ma
2026-10-19 11:29   ` Temerkhanov, Sergey
2026-10-20  9:24   ` Przemek Kitszel
2026-10-22 18:06     ` Jacob Keller
2026-10-19 10:51 ` [PATCH 3/5] ice: scope global configuration lock to the adapter Aaron Ma
2026-10-21 11:12   ` Loktionov, Aleksandr
2026-10-22  8:17     ` Aaron Ma
2026-10-22 11:10   ` Przemek Kitszel
2026-10-22 18:19     ` Jacob Keller [this message]
2026-10-19 10:51 ` [PATCH 4/5] ice: clear DVM boost table before scanning package hints Aaron Ma
2026-10-19 10:51 ` [PATCH 5/5] ice: quiesce PTP periodic work before system suspend Aaron Ma
2026-10-21 12:14   ` Loktionov, Aleksandr
2026-10-22 18:22   ` 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=1232046a-bd51-4dfb-9eac-720e1a943dbf@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=aaron.ma@canonical.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=brett.creeley@intel.com \
    --cc=dan.nowlin@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=richardcochran@gmail.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

all inboxes | Powered by JetHome®