netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Mirsad Todorovac <mirsad.todorovac@alu.hr>,
	Jakub Kicinski <kuba@kernel.org>, Sasha Levin <sashal@kernel.org>
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>,
	Simon Horman <horms@kernel.org>,
	"David S . Miller" <davem@davemloft.net>,
	nic_swsd@realtek.com, edumazet@google.com, pabeni@redhat.com,
	netdev@vger.kernel.org
Subject: Re: [PATCH AUTOSEL 6.7 021/108] r8169: improve RTL8411b phy-down fixup
Date: Wed, 17 Jan 2024 12:10:01 +0100	[thread overview]
Message-ID: <8c83c826-e8a3-4057-88c6-4a7813ed6497@gmail.com> (raw)
In-Reply-To: <4523ad21-d06a-4ba2-9b46-974a6093b189@alu.unizg.hr>

On 17.01.2024 11:30, Mirsad Todorovac wrote:
> On 1/17/24 02:43, Jakub Kicinski wrote:
>> On Tue, 16 Jan 2024 14:38:47 -0500 Sasha Levin wrote:
>>> Mirsad proposed a patch to reduce the number of spinlock lock/unlock
>>> operations and the function code size. This can be further improved
>>> because the function sets a consecutive register block.
>>
>> Clearly a noop and a lot of LoC changed. I vote to drop this from
>> the backport.
> 
> Dear Jakub,
> 
> I will not argue with a senior developer, but please let me plead for the
> cause.
> 
> There are a couple of issues here:
> 
> 1. Heiner's patch generates smaller and faster code, with 100+
> spin_lock_irqsave()/spin_unlock_restore() pairs less.
> 
> According to this table:
> 
> [1] https://mirrors.edge.kernel.org/pub/linux/kernel/people/paulmck/perfbook/perfbook-1c.2023.06.11a.pdf#table.3.1
> 
> The cost of single lock can be 15.4 - 101.9 ns (for the example CPU),
> so total savings would be 1709 - 11310 ns. But as the event of PHY power
> down is not frequent, this might be a insignificant saving indeed.
> 
> 2. Why I had advertised atomic programming of RTL registers in the first
> place?
> 
> The mac_ocp_lock was introduced recently:
> 
> commit 91c8643578a21e435c412ffbe902bb4b4773e262
> Author: Heiner Kallweit <hkallweit1@gmail.com>
> Date:   Mon Mar 6 22:23:15 2023 +0100
> 
>     r8169: use spinlock to protect mac ocp register access
> 
>     For disabling ASPM during NAPI poll we'll have to access mac ocp
>     registers in atomic context. This could result in races because
>     a mac ocp read consists of a write to register OCPDR, followed
>     by a read from the same register. Therefore add a spinlock to
>     protect access to mac ocp registers.
> 
>     Reviewed-by: Simon Horman <simon.horman@corigine.com>
>     Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
>     Tested-by: Holger Hoffstätte <holger@applied-asynchrony.com>
>     Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>     Signed-off-by: David S. Miller <davem@davemloft.net>
> 
> Well, the answer is in the question - the very need for protecting the access
> to RTL_W(8|16|32) with locks comes from the fact that something was accessing
> the RTL card asynchronously.
> 
> Forgive me if this is a stupid question ...
> 
> Now - do we have a guarantee that the card will not be used asynchronously
> half-programmed from something else in that case, leading to another spurious
> lockup?
> 
> IMHO, shouldn't the entire reprogramming of PHY down recovery of the RTL 8411b
> be done atomically, under a single spin_lock_irqsave()/spin_unlock_irqrestore()
> pair?
> 

There's no actual issue that requires fixing. It's an improvement.

> Best regards,
> Mirsad Todorovac
> 


  reply	other threads:[~2024-01-17 11:10 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240116194225.250921-1-sashal@kernel.org>
2024-01-16 19:38 ` [PATCH AUTOSEL 6.7 019/108] net: phy: micrel: fix ts_info value in case of no phc Sasha Levin
2024-01-16 19:38 ` [PATCH AUTOSEL 6.7 021/108] r8169: improve RTL8411b phy-down fixup Sasha Levin
2024-01-17  1:43   ` Jakub Kicinski
2024-01-17 10:30     ` Mirsad Todorovac
2024-01-17 11:10       ` Heiner Kallweit [this message]
2024-01-17 13:44       ` Andrew Lunn
2024-01-17 16:35         ` Mirsad Todorovac
2024-01-17 17:04           ` Andrew Lunn
2024-01-16 19:38 ` [PATCH AUTOSEL 6.7 022/108] bonding: return -ENOMEM instead of BUG in alb_upper_dev_walk Sasha Levin
2024-01-16 19:38 ` [PATCH AUTOSEL 6.7 023/108] net: usb: ax88179_178a: avoid two consecutive device resets Sasha Levin
2024-01-16 19:38 ` [PATCH AUTOSEL 6.7 031/108] bpf: Fix a few selftest failures due to llvm18 change Sasha Levin
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 036/108] bnxt_en: Add 5760X (P7) PCI IDs Sasha Levin
2024-01-16 19:47   ` Michael Chan
2024-01-30 21:44     ` Sasha Levin
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 043/108] net: mvmdio: Avoid excessive sleeps in polled mode Sasha Levin
2024-01-17  1:42   ` Jakub Kicinski
2024-01-17  1:54     ` Andrew Lunn
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 050/108] net: wangxun: fix changing mac failed when running Sasha Levin
2024-01-17  1:39   ` Jakub Kicinski
2024-01-30 22:51     ` Sasha Levin
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 060/108] net: phy: at803x: fix passing the wrong reference for config_intr Sasha Levin
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 061/108] ionic: pass opcode to devcmd_wait Sasha Levin
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 062/108] ionic: bypass firmware cmds when stuck in reset Sasha Levin
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 066/108] selftests/bpf: fix compiler warnings in RELEASE=1 mode Sasha Levin
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 075/108] ice: fix ICE_AQ_VSI_Q_OPT_RSS_* register values Sasha Levin
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 076/108] net: atlantic: eliminate double free in error handling logic Sasha Levin
2024-01-17  1:38   ` Jakub Kicinski
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 077/108] net: dsa: mv88e6xxx: Fix mv88e6352_serdes_get_stats error path Sasha Levin
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 087/108] intel: add bit macro includes where needed Sasha Levin
2024-01-16 19:39 ` [PATCH AUTOSEL 6.7 088/108] ice: fix pre-shifted bit usage Sasha Levin
2024-01-16 19:40 ` [PATCH AUTOSEL 6.7 095/108] wifi: cfg80211: free beacon_ies when overridden from hidden BSS Sasha Levin
2024-01-16 19:40 ` [PATCH AUTOSEL 6.7 100/108] net/smc: disable SEID on non-s390 archs where virtual ISM may be used Sasha Levin
2024-01-16 19:40 ` [PATCH AUTOSEL 6.7 101/108] bridge: cfm: fix enum typo in br_cc_ccm_tx_parse Sasha Levin
2024-01-16 19:40 ` [PATCH AUTOSEL 6.7 104/108] i40e: Fix VF disable behavior to block all traffic Sasha Levin
2024-01-16 19:40 ` [PATCH AUTOSEL 6.7 105/108] octeontx2-af: Fix max NPC MCAM entry check while validating ref_entry Sasha Levin
2024-01-16 19:40 ` [PATCH AUTOSEL 6.7 106/108] net: kcm: fix direct access to bv_len Sasha Levin
2024-01-16 19:40 ` [PATCH AUTOSEL 6.7 107/108] net: dsa: qca8k: put MDIO bus OF node on qca8k_mdio_register() failure Sasha Levin

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=8c83c826-e8a3-4057-88c6-4a7813ed6497@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mirsad.todorovac@alu.hr \
    --cc=mirsad.todorovac@alu.unizg.hr \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=pabeni@redhat.com \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    /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).