From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Divya Koppera <divya.koppera@microchip.com>,
arun.ramadoss@microchip.com, UNGLinuxDriver@microchip.com,
hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
richardcochran@gmail.com
Subject: Re: [PATCH net-next v3 1/5] net: phy: microchip_ptp : Add header file for Microchip ptp library
Date: Tue, 12 Nov 2024 22:56:19 +0000 [thread overview]
Message-ID: <955cb079-b58d-4c32-8925-74f596312b21@linux.dev> (raw)
In-Reply-To: <53c8b505-f992-4c2e-b2c0-616152b447c3@lunn.ch>
On 12/11/2024 22:26, Andrew Lunn wrote:
>> I believe, the current design of mchp_ptp_clock has some issues:
>>
>> struct mchp_ptp_clock {
>> struct mii_timestamper mii_ts; /* 0 48 */
>> struct phy_device * phydev; /* 48 8 */
>> struct sk_buff_head tx_queue; /* 56 24 */
>> /* --- cacheline 1 boundary (64 bytes) was 16 bytes ago --- */
>> struct sk_buff_head rx_queue; /* 80 24 */
>> struct list_head rx_ts_list; /* 104 16 */
>> spinlock_t rx_ts_lock /* 120 4 */
>> int hwts_tx_type; /* 124 4 */
>> /* --- cacheline 2 boundary (128 bytes) --- */
>> enum hwtstamp_rx_filters rx_filter; /* 128 4 */
>> int layer; /* 132 4 */
>> int version; /* 136 4 */
>>
>> /* XXX 4 bytes hole, try to pack */
>>
>> struct ptp_clock * ptp_clock; /* 144 8 */
>> struct ptp_clock_info caps; /* 152 184 */
>> /* --- cacheline 5 boundary (320 bytes) was 16 bytes ago --- */
>> struct mutex ptp_lock; /* 336 32 */
>> u16 port_base_addr; /* 368 2 */
>> u16 clk_base_addr; /* 370 2 */
>> u8 mmd; /* 372 1 */
>>
>> /* size: 376, cachelines: 6, members: 16 */
>> /* sum members: 369, holes: 1, sum holes: 4 */
>> /* padding: 3 */
>> /* last cacheline: 56 bytes */
>> };
>>
>> tx_queue will be splitted across 2 cache lines and will have spinlock on the
>> cache line next to `struct sk_buff * next`. That means 2 cachelines
>> will have to fetched to have an access to it - may lead to performance
>> issues.
>>
>> Another issue is that locks in tx_queue and rx_queue, and rx_ts_lock
>> share the same cache line which, again, can have performance issues on
>> systems which can potentially have several rx/tx queues/irqs.
>>
>> It would be great to try to reorder the struct a bit.
>
> Dumb question: How much of this is in the hot patch? If this is only
> used for a couple of PTP packets per second, do we care about a couple
> of cache misses per second? Or will every single packet the PHY
> processes be affected by this?
Even with PTP packets timestamped only - imagine someone trying to run
PTP server part with some proper amount of clients? And it's valid to
configure more than 1 sync packet per second. It may become quite hot.
next prev parent reply other threads:[~2024-11-12 22:56 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-12 13:37 [PATCH net-next v3 0/5] Add ptp library for Microchip phys Divya Koppera
2024-11-12 13:37 ` [PATCH net-next v3 1/5] net: phy: microchip_ptp : Add header file for Microchip ptp library Divya Koppera
2024-11-12 22:01 ` Vadim Fedorenko
2024-11-12 22:26 ` Andrew Lunn
2024-11-12 22:56 ` Vadim Fedorenko [this message]
2024-11-12 23:11 ` Andrew Lunn
2024-11-12 23:21 ` Vadim Fedorenko
2024-11-12 13:37 ` [PATCH net-next v3 2/5] net: phy: microchip_ptp : Add ptp library for Microchip phys Divya Koppera
2024-11-12 22:20 ` Jakub Kicinski
2024-11-13 11:05 ` Divya.Koppera
2024-11-12 13:37 ` [PATCH net-next v3 3/5] net: phy: Kconfig: Add ptp library support and 1588 optional flag in " Divya Koppera
2024-11-12 13:37 ` [PATCH net-next v3 4/5] net: phy: Makefile: Add makefile support for ptp " Divya Koppera
2024-11-12 13:37 ` [PATCH net-next v3 5/5] net: phy: microchip_t1 : Add initialization of ptp for lan887x Divya Koppera
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=955cb079-b58d-4c32-8925-74f596312b21@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=UNGLinuxDriver@microchip.com \
--cc=andrew@lunn.ch \
--cc=arun.ramadoss@microchip.com \
--cc=davem@davemloft.net \
--cc=divya.koppera@microchip.com \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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 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.