All of lore.kernel.org
 help / color / mirror / Atom feed
From: Davidlohr Bueso <dave@stgolabs.net>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: linux-scsi@vger.kernel.org,
	"James E.J. Bottomley" <jejb@linux.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	GR-QLogic-Storage-Upstream@marvell.com,
	Hannes Reinecke <hare@suse.de>, Javed Hasan <jhasan@marvell.com>,
	Saurav Kashyap <skashyap@marvell.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Davidlohr Bueso <dbueso@suse.de>
Subject: Re: [PATCH 2/4] scsi: fcoe: Use per-CPU API to update per-CPU statistics.
Date: Mon, 9 May 2022 17:48:01 -0700	[thread overview]
Message-ID: <20220510004801.w6hiyka7gi2vnto5@offworld> (raw)
In-Reply-To: <20220506105758.283887-3-bigeasy@linutronix.de>

On Fri, 06 May 2022, Sebastian Andrzej Siewior wrote:

>The per-CPU statistics (struct fc_stats) is updated by getting a stable
>per-CPU pointer via get_cpu() + per_cpu_ptr() and then performing the
>increment. This can be optimized by using this_cpu_*() which will do
>whatever is needed on the architecture to perform the update safe and
>efficient.
>The read out of the individual value (fc_get_host_stats()) should be
>done by using READ_ONCE() instead of a plain-C access. The difference is
>that READ_ONCE() will always perform a single access while the plain-C
>access can be splitt by the compiler into two loads if it appears
>beneficial.
>The usage of u64 has the side-effect that it is also 64bit wide on 32bit
>architectures and the read is always split into two loads. The can lead
>to strange values if the read happens during an update which alters both
>32bit parts of the 64bit value. This can be circumvanted by either using
>a 32bit variables on 32bit architecures or extending the statistics with
>a sequence counter.
>
>Use this_cpu_*() API to update the statistics and READ_ONCE() to read
>it.

LGTM, feel free to add my:

Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>

  reply	other threads:[~2022-05-10  1:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-06 10:57 [PATCH 0/4] scsi: PREEMPT_RT related fixes Sebastian Andrzej Siewior
2022-05-06 10:57 ` [PATCH 1/4] scsi: fcoe: Add a local_lock to fcoe_percpu Sebastian Andrzej Siewior
2022-05-06 10:57 ` [PATCH 2/4] scsi: fcoe: Use per-CPU API to update per-CPU statistics Sebastian Andrzej Siewior
2022-05-10  0:48   ` Davidlohr Bueso [this message]
2022-05-06 10:57 ` [PATCH 3/4] scsi: libfc: Remove get_cpu() semantics in fc_exch_em_alloc() Sebastian Andrzej Siewior
2022-05-06 10:57 ` [PATCH 4/4] scsi: bnx2fc: Avoid using get_cpu() in bnx2fc_cmd_alloc() Sebastian Andrzej Siewior
2022-05-07  4:46   ` Davidlohr Bueso
2022-05-17  1:28 ` [PATCH 0/4] scsi: PREEMPT_RT related fixes Martin K. Petersen
2022-05-17  6:11   ` Sebastian Andrzej Siewior
2022-05-20  1:09 ` Martin K. Petersen

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=20220510004801.w6hiyka7gi2vnto5@offworld \
    --to=dave@stgolabs.net \
    --cc=GR-QLogic-Storage-Upstream@marvell.com \
    --cc=bigeasy@linutronix.de \
    --cc=dbueso@suse.de \
    --cc=hare@suse.de \
    --cc=jejb@linux.ibm.com \
    --cc=jhasan@marvell.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=skashyap@marvell.com \
    --cc=tglx@linutronix.de \
    /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.