All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: "Olech, Milena" <milena.olech@intel.com>,
	"intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"Nguyen, Anthony L" <anthony.l.nguyen@intel.com>,
	"Kitszel, Przemyslaw" <przemyslaw.kitszel@intel.com>,
	"Lobakin, Aleksander" <aleksander.lobakin@intel.com>,
	"Tantilov, Emil S" <emil.s.tantilov@intel.com>,
	"Linga, Pavan Kumar" <pavan.kumar.linga@intel.com>,
	"Salin, Samuel" <samuel.salin@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH v10 iwl-next 09/11] idpf: add Tx timestamp capabilities negotiation
Date: Wed, 9 Apr 2025 11:08:46 -0700	[thread overview]
Message-ID: <6b39d76a-b2be-4d09-a4b6-efb01c4be006@intel.com> (raw)
In-Reply-To: <MW4PR11MB5889766212BD05ADC555FD608EB42@MW4PR11MB5889.namprd11.prod.outlook.com>



On 4/9/2025 7:04 AM, Olech, Milena wrote:
> On 4/8/2025 11:23 PM, Jacob Keller wrote:
> 
>> On 4/8/2025 3:31 AM, Milena Olech wrote:
>>> +static void idpf_ptp_release_vport_tstamp(struct idpf_vport *vport)
>>> +{
>>> +	struct idpf_ptp_tx_tstamp *ptp_tx_tstamp, *tmp;
>>> +	struct list_head *head;
>>> +
>>> +	/* Remove list with free latches */
>>> +	spin_lock(&vport->tx_tstamp_caps->lock_free);
>>> +
>>> +	head = &vport->tx_tstamp_caps->latches_free;
>>> +	list_for_each_entry_safe(ptp_tx_tstamp, tmp, head, list_member) {
>>> +		list_del(&ptp_tx_tstamp->list_member);
>>> +		kfree(ptp_tx_tstamp);
>>> +	}
>>> +
>>> +	spin_unlock(&vport->tx_tstamp_caps->lock_free);
>>> +
>>> +	/* Remove list with latches in use */
>>> +	spin_lock(&vport->tx_tstamp_caps->lock_in_use);
>>> +
>>> +	head = &vport->tx_tstamp_caps->latches_in_use;
>>> +	list_for_each_entry_safe(ptp_tx_tstamp, tmp, head, list_member) {
>>> +		list_del(&ptp_tx_tstamp->list_member);
>>> +		kfree(ptp_tx_tstamp);
>>> +	}
>>> +
>>> +	spin_unlock(&vport->tx_tstamp_caps->lock_in_use);
>>> +
>>> +	kfree(vport->tx_tstamp_caps);
>>> +	vport->tx_tstamp_caps = NULL;
>>> +}
>> Could you provide a summary and overview of the locking scheme used
>> here? I see you have multiple spin locks for both the free bits and the
>> in-use bits, and its a bit hard to grasp the reasoning behind this. We
>> had a lot of issues getting locking for Tx timestamps correct in ice,
>> though most of that had to do with quirks in the hardware.
>>
> 
> Ofc :) So the main idea is to have a list of free latches (indexes) and a
> list of latches that are being used - by used I mean that the timestamp
> for this index is requested and being processed.
> 
> So at the beginning, the driver negotiates the list of latches with the CP
> and adds them to the free list. When the timestamp is requested, driver
> takes the first item of the free latches and moves it to 'in-use' list.
> Similarly, when the timestamp is read, driver moves the index from
> 'in use' to 'free'.
> 

Ok. Is there a reason these need separate locks instead of just sharing
the same lock?

> Regards,
> Milena
> 
>> Thanks,
>> Jake
>>


  reply	other threads:[~2025-04-09 18:08 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-08 10:30 [Intel-wired-lan] [PATCH v10 iwl-next 00/11] idpf: add initial PTP support Milena Olech
2025-04-08 10:30 ` Milena Olech
2025-04-08 10:30 ` [Intel-wired-lan] [PATCH v10 iwl-next 01/11] idpf: change the method for mailbox workqueue allocation Milena Olech
2025-04-08 10:30   ` Milena Olech
2025-04-08 21:01   ` [Intel-wired-lan] " Jacob Keller
2025-04-08 10:30 ` [Intel-wired-lan] [PATCH v10 iwl-next 02/11] idpf: add initial PTP support Milena Olech
2025-04-08 10:30   ` Milena Olech
2025-04-08 21:02   ` [Intel-wired-lan] " Jacob Keller
2025-04-08 10:30 ` [Intel-wired-lan] [PATCH v10 iwl-next 03/11] virtchnl: add PTP virtchnl definitions Milena Olech
2025-04-08 10:30   ` Milena Olech
2025-04-08 21:12   ` [Intel-wired-lan] " Jacob Keller
2025-04-09 11:51     ` Olech, Milena
2025-04-09 11:51       ` Olech, Milena
2025-04-09 18:11       ` Jacob Keller
2025-04-10 13:18         ` Olech, Milena
2025-04-10 13:18           ` Olech, Milena
2025-04-08 10:30 ` [Intel-wired-lan] [PATCH v10 iwl-next 04/11] idpf: move virtchnl structures to the header file Milena Olech
2025-04-08 10:30   ` Milena Olech
2025-04-08 21:12   ` [Intel-wired-lan] " Jacob Keller
2025-04-08 10:30 ` [Intel-wired-lan] [PATCH v10 iwl-next 05/11] idpf: negotiate PTP capabilities and get PTP clock Milena Olech
2025-04-08 10:30   ` Milena Olech
2025-04-08 21:15   ` [Intel-wired-lan] " Jacob Keller
2025-04-09 12:55     ` Olech, Milena
2025-04-09 12:55       ` Olech, Milena
2025-04-09 18:14       ` Jacob Keller
2025-04-08 10:30 ` [Intel-wired-lan] [PATCH v10 iwl-next 06/11] idpf: add mailbox access to read PTP clock time Milena Olech
2025-04-08 10:30   ` Milena Olech
2025-04-08 21:16   ` [Intel-wired-lan] " Jacob Keller
2025-04-09 13:01     ` Olech, Milena
2025-04-09 13:01       ` Olech, Milena
2025-04-08 21:17   ` Jacob Keller
2025-04-08 10:31 ` [Intel-wired-lan] [PATCH v10 iwl-next 07/11] idpf: add cross timestamping Milena Olech
2025-04-08 10:31   ` Milena Olech
2025-04-08 21:18   ` [Intel-wired-lan] " Jacob Keller
2025-04-08 10:31 ` [Intel-wired-lan] [PATCH v10 iwl-next 08/11] idpf: add PTP clock configuration Milena Olech
2025-04-08 10:31   ` Milena Olech
2025-04-08 21:20   ` [Intel-wired-lan] " Jacob Keller
2025-04-08 10:31 ` [Intel-wired-lan] [PATCH v10 iwl-next 09/11] idpf: add Tx timestamp capabilities negotiation Milena Olech
2025-04-08 10:31   ` Milena Olech
2025-04-08 21:23   ` [Intel-wired-lan] " Jacob Keller
2025-04-09 14:04     ` Olech, Milena
2025-04-09 14:04       ` Olech, Milena
2025-04-09 18:08       ` Jacob Keller [this message]
2025-04-10 14:11         ` Olech, Milena
2025-04-10 14:11           ` Olech, Milena
2025-04-10 15:36           ` Keller, Jacob E
2025-04-10 15:36             ` Keller, Jacob E
2025-04-08 10:31 ` [Intel-wired-lan] [PATCH v10 iwl-next 10/11] idpf: add Tx timestamp flows Milena Olech
2025-04-08 10:31   ` Milena Olech
2025-04-08 21:31   ` [Intel-wired-lan] " Jacob Keller
2025-04-10 13:28     ` Olech, Milena
2025-04-10 13:28       ` Olech, Milena
2025-04-08 10:31 ` [Intel-wired-lan] [PATCH v10 iwl-next 11/11] idpf: add support for Rx timestamping Milena Olech
2025-04-08 10:31   ` Milena Olech
2025-04-08 21:31   ` [Intel-wired-lan] " 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=6b39d76a-b2be-4d09-a4b6-efb01c4be006@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=anthony.l.nguyen@intel.com \
    --cc=emil.s.tantilov@intel.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=milena.olech@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=pavan.kumar.linga@intel.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=samuel.salin@intel.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.