<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/tools/testing/selftests/rseq/rseq-ppc.h, branch linux-rolling-stable</title>
<subtitle>Hosts the 0x221E linux distro kernel.</subtitle>
<id>https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-stable</id>
<link rel='self' href='https://universe.0xinfinity.dev/distro/kernel/atom?h=linux-rolling-stable'/>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/'/>
<updated>2023-08-08T20:42:12Z</updated>
<entry>
<title>selftests/rseq: Use rseq_unqual_scalar_typeof in macros</title>
<updated>2023-08-08T20:42:12Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2023-06-27T15:29:23Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=2b2fe6052dd01fdb4e9a31031c2c9d8f03cf7753'/>
<id>urn:sha1:2b2fe6052dd01fdb4e9a31031c2c9d8f03cf7753</id>
<content type='text'>
Use rseq_unqual_scalar_typeof() rather than typeof() in macros to remove
the volatile qualifier (if there is one in the input argument), thus
generating better assembly code in those scenarios.

Also add extra brackets around the "p" parameter in RSEQ_READ_ONCE(),
RSEQ_WRITE_ONCE(), and rseq_unqual_scalar_typeof() across architectures
to preserve expectations of operator priority. Here is an example that
shows how operator priority may be an issue with missing parentheses:

    #define m(p) \
    do { \
            __typeof__(*p) v = 0; \
    } while (0)

    void fct(unsigned long long *p1)
    {
            m(p1 + 1);      /* works */
            m(1 + p1);      /* broken */
    }

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>selftests/rseq: ppc: Template memory ordering and percpu access mode</title>
<updated>2022-12-27T11:52:14Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-11-22T20:39:17Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e61bd94c2bbd6b258fb408092172e37d39b4bf5c'/>
<id>urn:sha1:e61bd94c2bbd6b258fb408092172e37d39b4bf5c</id>
<content type='text'>
Introduce a rseq-ppc-bits.h template header which is internally included
to generate the static inline functions covering:

- relaxed and release memory ordering,
- per-cpu-id and per-mm-cid per-cpu data access.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20221122203932.231377-16-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: Remove RSEQ_SKIP_FASTPATH code</title>
<updated>2022-12-27T11:52:12Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-11-22T20:39:11Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=72cb1d7f2faca4fba81ab8417367d63852cd490c'/>
<id>urn:sha1:72cb1d7f2faca4fba81ab8417367d63852cd490c</id>
<content type='text'>
This code is not currently build by the test Makefile, adds complexity,
and is not overall useful considering that the abort handling loops to
retry the fast-path.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lore.kernel.org/r/20221122203932.231377-10-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: Fix: work-around asm goto compiler bugs</title>
<updated>2022-02-02T12:11:37Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:51Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=b53823fb2ef854222853be164f3b1e815f315144'/>
<id>urn:sha1:b53823fb2ef854222853be164f3b1e815f315144</id>
<content type='text'>
gcc and clang each have their own compiler bugs with respect to asm
goto. Implement a work-around for compiler versions known to have those
bugs.

gcc prior to 4.8.2 miscompiles asm goto.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58670

gcc prior to 8.1.0 miscompiles asm goto at O1.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103908

clang prior to version 13.0.1 miscompiles asm goto at O2.
https://github.com/llvm/llvm-project/issues/52735

Work around these issues by adding a volatile inline asm with
memory clobber in the fallthrough after the asm goto and at each
label target.  Emit this for all compilers in case other similar
issues are found in the future.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-14-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: Fix ppc32 offsets by using long rather than off_t</title>
<updated>2022-02-02T12:11:36Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:48Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=26dc8a6d8e11552f3b797b5aafe01071ca32d692'/>
<id>urn:sha1:26dc8a6d8e11552f3b797b5aafe01071ca32d692</id>
<content type='text'>
The semantic of off_t is for file offsets. We mean to use it as an
offset from a pointer. We really expect it to fit in a single register,
and not use a 64-bit type on 32-bit architectures.

Fix runtime issues on ppc32 where the offset is always 0 due to
inconsistency between the argument type (off_t -&gt; 64-bit) and type
expected by the inline assembler (32-bit).

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-11-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: Fix ppc32 missing instruction selection "u" and "x" for load/store</title>
<updated>2022-02-02T12:11:36Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:47Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=de6b52a21420a18dc8a36438d581efd1313d5fe3'/>
<id>urn:sha1:de6b52a21420a18dc8a36438d581efd1313d5fe3</id>
<content type='text'>
Building the rseq basic test  with
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.12)
Target: powerpc-linux-gnu

leads to these errors:

/tmp/ccieEWxU.s: Assembler messages:
/tmp/ccieEWxU.s:118: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:118: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:121: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:121: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:626: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:626: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:629: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:629: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:735: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:735: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:738: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:738: Error: junk at end of line: `,8'
/tmp/ccieEWxU.s:741: Error: syntax error; found `,', expected `('
/tmp/ccieEWxU.s:741: Error: junk at end of line: `,8'
Makefile:581: recipe for target 'basic_percpu_ops_test.o' failed

Based on discussion with Linux powerpc maintainers and review of
the use of the "m" operand in powerpc kernel code, add the missing
%Un%Xn (where n is operand number) to the lwz, stw, ld, and std
instructions when used with "m" operands.

Using "WORD" to mean either a 32-bit or 64-bit type depending on
the architecture is misleading. The term "WORD" really means a
32-bit type in both 32-bit and 64-bit powerpc assembler. The intent
here is to wrap load/store to intptr_t into common macros for both
32-bit and 64-bit.

Rename the macros with a RSEQ_ prefix, and use the terms "INT"
for always 32-bit type, and "LONG" for architecture bitness-sized
type.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-10-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: Fix ppc32: wrong rseq_cs 32-bit field pointer on big endian</title>
<updated>2022-02-02T12:11:35Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:46Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=24d1136a29da5953de5c0cbc6c83eb62a1e0bf14'/>
<id>urn:sha1:24d1136a29da5953de5c0cbc6c83eb62a1e0bf14</id>
<content type='text'>
ppc32 incorrectly uses padding as rseq_cs pointer field. Fix this by
using the rseq_cs.arch.ptr field.

Use this field across all architectures.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-9-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>selftests/rseq: Introduce rseq_get_abi() helper</title>
<updated>2022-02-02T12:11:35Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2022-01-24T17:12:43Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=e546cd48ccc456074ddb8920732aef4af65d7ca7'/>
<id>urn:sha1:e546cd48ccc456074ddb8920732aef4af65d7ca7</id>
<content type='text'>
This is done in preparation for the selftest uplift to become compatible
with glibc-2.35.

glibc-2.35 exposes the rseq per-thread data in the TCB, accessible
at an offset from the thread pointer, rather than through an actual
Thread-Local Storage (TLS) variable, as the kernel selftests initially
expected.

Introduce a rseq_get_abi() helper, initially using the __rseq_abi
TLS variable, in preparation for changing this userspace ABI for one
which is compatible with glibc-2.35.

Note that the __rseq_abi TLS and glibc-2.35's ABI for per-thread data
cannot actively coexist in a process, because the kernel supports only
a single rseq registration per thread.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
Signed-off-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20220124171253.22072-6-mathieu.desnoyers@efficios.com
</content>
</entry>
<entry>
<title>rseq/selftests: powerpc code signature: generate valid instructions</title>
<updated>2019-05-07T21:33:00Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2019-04-29T15:28:01Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=496fd0fc9f5c4c187e69e8697387a7604ab7141d'/>
<id>urn:sha1:496fd0fc9f5c4c187e69e8697387a7604ab7141d</id>
<content type='text'>
Use "twui" as the guard instruction for the restartable sequence abort
handler.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
CC: Benjamin Herrenschmidt &lt;benh@kernel.crashing.org&gt;
CC: Paul Mackerras &lt;paulus@samba.org&gt;
CC: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
CC: Boqun Feng &lt;boqun.feng@gmail.com&gt;
CC: Peter Zijlstra &lt;peterz@infradead.org&gt;
CC: "Paul E. McKenney" &lt;paulmck@linux.vnet.ibm.com&gt;
CC: Alan Modra &lt;amodra@gmail.com&gt;
CC: linuxppc-dev@lists.ozlabs.org
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>rseq/selftests: Introduce __rseq_cs_ptr_array, rename __rseq_table to __rseq_cs</title>
<updated>2019-05-07T21:31:36Z</updated>
<author>
<name>Mathieu Desnoyers</name>
<email>mathieu.desnoyers@efficios.com</email>
</author>
<published>2019-04-29T15:27:54Z</published>
<link rel='alternate' type='text/html' href='https://universe.0xinfinity.dev/distro/kernel/commit/?id=a3e3131f94aa1daeb978ed66d0b4e61156ef2c2a'/>
<id>urn:sha1:a3e3131f94aa1daeb978ed66d0b4e61156ef2c2a</id>
<content type='text'>
The entries within __rseq_table are aligned on 32 bytes due to
linux/rseq.h struct rseq_cs uapi requirements, but the start of the
__rseq_table section is not guaranteed to be 32-byte aligned. It can
cause padding to be added at the start of the section, which makes it
hard to use as an array of items by debuggers.

Considering that __rseq_table does not really consist of a table due to
the presence of padding, rename this section to __rseq_cs.

Create a new __rseq_cs_ptr_array section which contains 64-bit packed
pointers to entries within the __rseq_cs section.

Signed-off-by: Mathieu Desnoyers &lt;mathieu.desnoyers@efficios.com&gt;
CC: Thomas Gleixner &lt;tglx@linutronix.de&gt;
CC: Joel Fernandes &lt;joelaf@google.com&gt;
CC: Peter Zijlstra &lt;peterz@infradead.org&gt;
CC: Catalin Marinas &lt;catalin.marinas@arm.com&gt;
CC: Dave Watson &lt;davejwatson@fb.com&gt;
CC: Will Deacon &lt;will.deacon@arm.com&gt;
CC: Shuah Khan &lt;shuah@kernel.org&gt;
CC: Andi Kleen &lt;andi@firstfloor.org&gt;
CC: linux-kselftest@vger.kernel.org
CC: "H . Peter Anvin" &lt;hpa@zytor.com&gt;
CC: Chris Lameter &lt;cl@linux.com&gt;
CC: Russell King &lt;linux@arm.linux.org.uk&gt;
CC: Michael Kerrisk &lt;mtk.manpages@gmail.com&gt;
CC: "Paul E . McKenney" &lt;paulmck@linux.vnet.ibm.com&gt;
CC: Paul Turner &lt;pjt@google.com&gt;
CC: Boqun Feng &lt;boqun.feng@gmail.com&gt;
CC: Josh Triplett &lt;josh@joshtriplett.org&gt;
CC: Steven Rostedt &lt;rostedt@goodmis.org&gt;
CC: Ben Maurer &lt;bmaurer@fb.com&gt;
CC: linux-api@vger.kernel.org
CC: Andy Lutomirski &lt;luto@amacapital.net&gt;
CC: Andrew Morton &lt;akpm@linux-foundation.org&gt;
CC: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Signed-off-by: Shuah Khan &lt;skhan@linuxfoundation.org&gt;
</content>
</entry>
</feed>
