[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5315574130a7091d338fc2d7132fc4873f2186c6.camel@infradead.org>
Date: Tue, 02 Dec 2025 23:45:33 +0000
From: David Woodhouse <dwmw2@...radead.org>
To: "Chalios, Babis" <bchalios@...zon.es>, "richardcochran@...il.com"
<richardcochran@...il.com>, "andrew+netdev@...n.ch"
<andrew+netdev@...n.ch>, "davem@...emloft.net" <davem@...emloft.net>,
"edumazet@...gle.com" <edumazet@...gle.com>, "kuba@...nel.org"
<kuba@...nel.org>, "pabeni@...hat.com" <pabeni@...hat.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Cc: "Graf (AWS), Alexander" <graf@...zon.de>, "mzxreary@...inter.de"
<mzxreary@...inter.de>
Subject: Re: [PATCH v2 2/4] ptp: vmclock: support device notifications
On Tue, 2025-12-02 at 20:11 +0000, Chalios, Babis wrote:
>
> @@ -402,8 +413,16 @@ static ssize_t vmclock_miscdev_read(struct file *fp, char __user *buf,
>
> /* Pairs with hypervisor wmb */
> virt_rmb();
> - if (seq == le32_to_cpu(st->clk->seq_count))
> - break;
> + if (seq == le32_to_cpu(st->clk->seq_count)) {
> + /*
> + * Either we updated fst->seq to seq (the latest version we observed)
> + * or someone else did (old_seq == seq), so we can break.
> + */
> + if (atomic_try_cmpxchg(&fst->seq, &old_seq, seq) ||
> + old_seq == seq) {
> + break;
> + }
> + }
>
> if (ktime_after(ktime_get(), deadline))
> return -ETIMEDOUT;
I'm slightly confused that that compiles cleanly (as it does here).
Isn't the second argument to atomic_try_cmpxchg() an (int *), and isn't
old_seq a uint32_t? It's doing the right thing; I just didn't think it
would do the right thing *quietly*... ?
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5069 bytes)
Powered by blists - more mailing lists