Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions storage/innobase/sync/cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ static decltype(pmem_control::persist) pmem_persist_init()
return (getauxval(AT_HWCAP) & HWCAP_DCPOP) ? pmem_cvap : pmem_cvac;
}
# elif defined __powerpc64__
__attribute__((target("cpu=power10")))
static void pmem_phwsync(const void* buf, size_t size)
Comment on lines 101 to 103

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://godbolt.org this attribute is not supported on clang nor on GCC up to version 9. There is no GCC 10 or 11 available for this platform.

I think that it is more future-proof to hide the high-level instruction from the compiler, similar to what we did in #5105.

There is a clang available on https://godbolt.org. For clang, no matter what I try, I get no code emitted at all when I enable "Compile to binary object" in the output options. That option is more important on GCC, because GCC lacks a built-in assembler and is just copying the inline assembler input to output without validating it. I tested GCC with the following:

void f(void *u) {
    __asm__ __volatile__(".long (0x7cc000AC | %0 << 11)" :: "r"(u) : "memory");
}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rhel9 is 11.5.0. rhel8 8.5.0 which is where the gcc9 come in.

Waiting on CI results a bit to be sure.

Not sure yet of the hiding the high level is the way to go. Its a bit of a different mapping to the 5105 PR.

on clang (sid) taking an extract of the function:

buildbot@5bb9477a0460:/build$ clang++ -c  -o x.o /source/x.c++ 
'power10' is not a recognized processor for this target (ignoring processor)
'power10' is not a recognized processor for this target (ignoring processor)
'power10' is not a recognized processor for this target (ignoring processor)
'power10' is not a recognized processor for this target (ignoring processor)
'power10' is not a recognized processor for this target (ignoring processor)
buildbot@5bb9477a0460:/build$ objdump -d x.o

x.o:     file format elf64-powerpcle


Disassembly of section .text:

0000000000000000 <_Z12pmem_phwsyncPKvm>:
   0:	f0 ff 61 f8 	std     r3,-16(r1)
   4:	e8 ff 81 f8 	std     r4,-24(r1)
   8:	f0 ff 61 e8 	ld      r3,-16(r1)
   c:	7f ff 80 38 	li      r4,-129
  10:	38 20 63 7c 	and     r3,r3,r4
  14:	e0 ff 61 f8 	std     r3,-32(r1)
  18:	f0 ff 61 e8 	ld      r3,-16(r1)
  1c:	e8 ff 81 e8 	ld      r4,-24(r1)
  20:	14 22 63 7c 	add     r3,r3,r4
  24:	d8 ff 61 f8 	std     r3,-40(r1)
  28:	e0 ff 61 e8 	ld      r3,-32(r1)
  2c:	d8 ff 81 e8 	ld      r4,-40(r1)
  30:	40 20 23 7c 	cmpld   r3,r4
  34:	1c 00 80 40 	bge     50 <_Z12pmem_phwsyncPKvm+0x50>
  38:	e0 ff 61 e8 	ld      r3,-32(r1)
  3c:	ac 18 c0 7c 	dcbstps 0,r3
  40:	e0 ff 61 e8 	ld      r3,-32(r1)
  44:	80 00 63 38 	addi    r3,r3,128
  48:	e0 ff 61 f8 	std     r3,-32(r1)
  4c:	dc ff ff 4b 	b       28 <_Z12pmem_phwsyncPKvm+0x28>
  50:	ac 04 80 7c 	phwsync
  54:	20 00 80 4e 	blr
	...


buildbot@5bb9477a0460:/build$ clang++ --version
Debian clang version 21.1.8 (10)
Target: powerpc64le-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-21/bin

Weird warnings but the syncs are there.

{
for (uintptr_t u= uintptr_t(buf) & ~(CPU_LEVEL1_DCACHE_LINESIZE),
Expand Down