[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <28bdcf4c-6903-4555-8cbc-a93704ec05f9@rowland.harvard.edu>
Date: Wed, 5 Jun 2024 11:31:51 -0400
From: Alan Stern <stern@...land.harvard.edu>
To: Andrea Parri <parri.andrea@...il.com>
Cc: will@...nel.org, peterz@...radead.org, boqun.feng@...il.com,
npiggin@...il.com, dhowells@...hat.com, j.alglave@....ac.uk,
luc.maranget@...ia.fr, paulmck@...nel.org, akiyks@...il.com,
dlustig@...dia.com, joel@...lfernandes.org, linux-kernel@...r.kernel.org,
linux-arch@...r.kernel.org, hernan.poncedeleon@...weicloud.com,
jonas.oberhauser@...weicloud.com
Subject: Re: [PATCH] tools/memory-model: Document herd7 (internal)
representation
On Mon, May 27, 2024 at 10:07:06AM +0200, Andrea Parri wrote:
> > It turns out the problem lies in the way lock.cat tries to calculate the
> > rf relation for RU events (a spin_is_locked() that returns False). The
> > method it uses amounts to requiring that such events must read from the
> > lock's initial value or an LU event (a spin_unlock()) in a different
> > thread. This clearly is wrong, and glaringly so in this litmus test
> > since there are no other threads!
> >
> > A patch to fix the problem and reorganize the code a bit for greater
> > readability is below. I'd appreciate it if people could try it out on
> > various locking litmus tests in our archives.
>
> Thanks for the quick solution, Alan. The results from our archives look
> good.
Here's a much smaller patch, suitable for the -stable kernels. It fixes
the bug without doing the larger code reorganization (which will go into
a separate patch). Can you test this one?
Alan
Index: usb-devel/tools/memory-model/lock.cat
===================================================================
--- usb-devel.orig/tools/memory-model/lock.cat
+++ usb-devel/tools/memory-model/lock.cat
@@ -102,19 +102,19 @@ let rf-lf = rfe-lf | rfi-lf
* within one of the lock's critical sections returns False.
*)
-(* rfi for RU events: an RU may read from the last po-previous UL *)
-let rfi-ru = ([UL] ; po-loc ; [RU]) \ ([UL] ; po-loc ; [LKW] ; po-loc)
-
-(* rfe for RU events: an RU may read from an external UL or the initial write *)
-let all-possible-rfe-ru =
- let possible-rfe-ru r =
+(*
+ * rf for RU events: an RU may read from an external UL or the initial write,
+ * or from the last po-previous UL
+ *)
+let all-possible-rf-ru =
+ let possible-rf-ru r =
let pair-to-relation p = p ++ 0
- in map pair-to-relation (((UL | IW) * {r}) & loc & ext)
- in map possible-rfe-ru RU
+ in map pair-to-relation ((((UL | IW) * {r}) & loc & ext) |
+ (((UL * {r}) & po-loc) \ ([UL] ; po-loc ; [LKW] ; po-loc)))
+ in map possible-rf-ru RU
(* Generate all rf relations for RU events *)
-with rfe-ru from cross(all-possible-rfe-ru)
-let rf-ru = rfe-ru | rfi-ru
+with rf-ru from cross(all-possible-rf-ru)
(* Final rf relation *)
let rf = rf | rf-lf | rf-ru
Powered by blists - more mailing lists