From: Adam Young <admiyo@os.amperecomputing.com>
To: Sudeep Holla <sudeep.holla@kernel.org>,
Jassi Brar <jassisinghbrar@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeremy Kerr <jk@codeconstruct.com.au>,
Matt Johnston <matt@codeconstruct.com.au>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Sudeep Holla <sudeep.holla@arm.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Huisong Li <lihuisong@huawei.com>
Subject: [PATCH v45 7/7] wrap pchan->chan_in_use in READ/WRITE_ONCE
Date: Tue, 21 Jul 2026 13:52:56 -0400 [thread overview]
Message-ID: <20260721175258.87600-8-admiyo@os.amperecomputing.com> (raw)
In-Reply-To: <20260721175258.87600-1-admiyo@os.amperecomputing.com>
read/write happening from both userspace and Hard IRQ context
chan_in_use is used a flag to sychronize access. Volitile
semantics ensure we don't have a reordering that accidentally
provide dual access.
Signed-off-by: Adam Young <admiyo@os.amperecomputing.com>
---
drivers/mailbox/pcc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/mailbox/pcc.c b/drivers/mailbox/pcc.c
index 2ce2afd255f0..dbfe8dd92ddd 100644
--- a/drivers/mailbox/pcc.c
+++ b/drivers/mailbox/pcc.c
@@ -325,7 +325,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
return IRQ_NONE;
if (pchan->type == ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE &&
- !pchan->chan_in_use)
+ !READ_ONCE(pchan->chan_in_use))
return IRQ_NONE;
if (!pcc_mbox_cmd_complete_check(pchan))
@@ -339,7 +339,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)
* where the flag is set again to start new transfer. This is
* required to avoid any possible race in updatation of this flag.
*/
- pchan->chan_in_use = false;
+ WRITE_ONCE(pchan->chan_in_use, false);
if (!rc)
mbox_chan_received_data(chan, NULL);
mbox_chan_txdone(chan, rc);
@@ -471,7 +471,7 @@ static int pcc_send_data(struct mbox_chan *chan, void *data)
ret = pcc_chan_reg_read_modify_write(&pchan->db);
if (!ret && pchan->plat_irq > 0)
- pchan->chan_in_use = true;
+ WRITE_ONCE(pchan->chan_in_use, true);
return ret;
}
--
2.43.0
next prev parent reply other threads:[~2026-07-21 17:53 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-21 17:52 [PATCH v45 0/7] MCTP over PCC Adam Young
2026-07-21 17:52 ` [PATCH v45 1/7] mailbox/pcc.c: shmem map/unmap startup/teardown Adam Young
2026-07-24 17:59 ` Adam Young
2026-08-11 17:34 ` Jassi Brar
2026-08-13 5:00 ` Sudeep Holla
2026-07-21 17:52 ` [PATCH v45 2/7] mailbox/pcc.c: ignore errors on type 4 channels Adam Young
2026-07-22 8:55 ` Sudeep Holla
2026-07-22 17:04 ` Adam Young
2026-07-21 17:52 ` [PATCH v45 3/7] mailbox/pcc.c: report errors for PCC clients Adam Young
2026-07-22 9:07 ` Sudeep Holla
2026-07-22 17:07 ` Adam Young
2026-07-21 17:52 ` [PATCH v45 4/7] mailbox/pcc.c: add query channel function Adam Young
2026-07-21 17:52 ` [PATCH v45 5/7] mctp pcc: Implement MCTP over PCC Transport Adam Young
2026-07-21 17:52 ` [PATCH v45 6/7] synchronize IRQ before releasing shared memory Adam Young
2026-07-21 17:52 ` Adam Young [this message]
2026-07-22 8:50 ` [PATCH v45 7/7] wrap pchan->chan_in_use in READ/WRITE_ONCE Sudeep Holla
2026-07-22 18:58 ` Adam Young
2026-07-27 16:20 ` [PATCH v45 0/7] MCTP over PCC Adam Young
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=20260721175258.87600-8-admiyo@os.amperecomputing.com \
--to=admiyo@os.amperecomputing.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jassisinghbrar@gmail.com \
--cc=jk@codeconstruct.com.au \
--cc=kuba@kernel.org \
--cc=lihuisong@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeconstruct.com.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sudeep.holla@arm.com \
--cc=sudeep.holla@kernel.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
all inboxes | Powered by JetHome®