Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sinan Kaya <okaya@codeaurora.org>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [PATCH 7/7] ixgbevf: eliminate duplicate barriers on weakly-ordered archs
Date: Thu, 15 Mar 2018 12:21:17 -0400	[thread overview]
Message-ID: <eee8269d-b711-828c-ab84-5933bf86d024@codeaurora.org> (raw)
In-Reply-To: <CAKgT0UcBQRoSPPZ73bdu1oEBGqBA8_c3ZAjti20=+9UwEqpXbw@mail.gmail.com>

On 3/15/2018 10:32 AM, Alexander Duyck wrote:
> We tend to do something like:
>   update tx_buffer_info
>   update tx_desc
>   wmb()
>   point first tx_buffer_info next_to_watch value at last tx_desc
>   update next_to_use
>   notify device via writel
> 
> We do it this way because we have to synchronize between the Tx
> cleanup path and the hardware so we basically lump the two barriers
> together. instead of invoking both a smp_wmb and a wmb. Now that I
> look at the pseudocode though I wonder if we shouldn't move the
> next_to_use update before the wmb, but that might be material for
> another patch. Anyway, in the Tx cleanup path we should have an
> smp_rmb() after we read the next_to_watch values so that we avoid
> reading any of the other fields in the buffer_info if either the field
> is NULL or the descriptor pointed to has not been written back.

How do you feel about keeping wmb() very close to writel_relaxed() like this?

   update tx_buffer_info
   update tx_desc
   point first tx_buffer_info next_to_watch value at last tx_desc
   update next_to_use
   wmb()
   notify device via writel_relaxed()

I'm afraid that if the order of wmb() and writel() is not very
obvious or hidden in multiple functions, somebody can introduce a very nasty
bug in the future.

We also have to think about code maintenance.

-- 
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.

  reply	other threads:[~2018-03-15 16:21 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-14  3:20 [Intel-wired-lan] [PATCH 1/7] i40e/i40evf: Eliminate duplicate barriers on weakly-ordered archs Sinan Kaya
2018-03-14  3:20 ` [Intel-wired-lan] [PATCH 2/7] ixgbe: eliminate " Sinan Kaya
2018-03-15  1:47   ` Alexander Duyck
2018-03-14  3:20 ` [Intel-wired-lan] [PATCH 4/7] igbvf: " Sinan Kaya
2018-03-15  1:48   ` Alexander Duyck
2018-03-14  3:20 ` [Intel-wired-lan] [PATCH 5/7] igb: " Sinan Kaya
2018-03-15  1:50   ` Alexander Duyck
2018-03-14  3:20 ` [Intel-wired-lan] [PATCH 6/7] e1000: " Sinan Kaya
2018-03-15  1:41   ` Alexander Duyck
2018-03-15 23:30     ` Sinan Kaya
2018-03-16  0:25       ` Alexander Duyck
2018-03-16  0:50         ` Sinan Kaya
2018-03-14  3:20 ` [Intel-wired-lan] [PATCH 7/7] ixgbevf: " Sinan Kaya
2018-03-14  5:08   ` Timur Tabi
2018-03-14 12:13     ` okaya
2018-03-14 21:49       ` Alexander Duyck
2018-03-14 22:57         ` Sinan Kaya
2018-03-15  1:44           ` Alexander Duyck
2018-03-15  2:17             ` Sinan Kaya
2018-03-15 14:32               ` Alexander Duyck
2018-03-15 16:21                 ` Sinan Kaya [this message]
2018-03-15 16:27                   ` Sinan Kaya
2018-03-15 16:58                     ` Alexander Duyck
2018-03-15  1:45   ` Alexander Duyck

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=eee8269d-b711-828c-ab84-5933bf86d024@codeaurora.org \
    --to=okaya@codeaurora.org \
    --cc=intel-wired-lan@osuosl.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