From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Michael Chan <michael.chan@broadcom.com>,
Vadim Fedorenko <vadfed@meta.com>
Cc: Jakub Kicinski <kuba@kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Subject: Re: [PATCH net-next] bnxt_en: replace PTP spinlock with seqlock
Date: Tue, 15 Oct 2024 14:01:26 +0100 [thread overview]
Message-ID: <a94404f1-93a9-4d13-9207-c95eff0d8b7f@linux.dev> (raw)
In-Reply-To: <CACKFLinJE-QfyUSDpYYfKtKEypMKZX_y_rAm_nQCQz_cDh8YjQ@mail.gmail.com>
On 15/10/2024 07:20, Michael Chan wrote:
> On Mon, Oct 14, 2024 at 4:29 PM Vadim Fedorenko <vadfed@meta.com> wrote:
>>
>> We can see high contention on ptp_lock while doing RX timestamping
>> on high packet rates over several queues. Spinlock is not effecient
>> to protect timecounter for RX timestamps when reads are the most
>> usual operations and writes are only occasional. It's better to use
>> seqlock in such cases.
>>
>> Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
>
>> -/* Caller holds ptp_lock */
>> static int bnxt_refclk_read(struct bnxt *bp, struct ptp_system_timestamp *sts,
>> u64 *ns)
>> {
>> struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
>> u32 high_before, high_now, low;
>>
>> + /* Make sure the RESET bit is set */
>> + smp_mb__before_atomic();
>
> This may not be sufficient. MMIO read of any register (clock register
> in this case) can hang the chip if it is undergoing reset.
>
>> if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))
>> return -EIO;
>
> We could have missed the flag and got here while the chip is about to be reset.
>
> I will review the patch in more detail tomorrow. Thanks.
Ok, so we have to serialize bnxt_refclk_read() and FW RESETS, but don't
block readers of ptp, especially on RX hot path. So it looks like
read_seqcount_excl_bh() can help us with it.
next prev parent reply other threads:[~2024-10-15 13:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-14 23:29 [PATCH net-next] bnxt_en: replace PTP spinlock with seqlock Vadim Fedorenko
2024-10-14 23:35 ` Jakub Kicinski
2024-10-15 10:25 ` Vadim Fedorenko
2024-10-15 15:41 ` Jakub Kicinski
2024-10-15 6:20 ` Michael Chan
2024-10-15 13:01 ` Vadim Fedorenko [this message]
2024-10-18 12:21 ` kernel test robot
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=a94404f1-93a9-4d13-9207-c95eff0d8b7f@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=vadfed@meta.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).