-
Notifications
You must be signed in to change notification settings - Fork 210
icache not flushed correctly #140
Comments
I don't have time to look into this right now, but I'm assuming it's probably some sort of mismatch between GCC, glibc, and Linux as to how the fence is supposed to end up getting emitted. Do you mind checking:
Thanks, and sorry for the headaches! |
Sure.
It does. Here is the generated code for the line that calls /home/marcus/hack/hi5cache/main.c:23
10588: fe843783 ld a5,-24(s0)
1058c: 02078713 addi a4,a5,32
10590: fe843783 ld a5,-24(s0)
10594: 4601 li a2,0
10596: 85ba mv a1,a4
10598: 853e mv a0,a5
1059a: 7ce140ef jal ra,24d68 <__riscv_flush_icache>
Yes. There is first some code to check if something called Now I had a clever idea though: I ran strace on the binary. This was the result:
Huh? Function not implemented? That doesn't sound right... (The extra interferrence of ptrace actually made the program output the correct result, hilariously enough :-)
Yup, looks exactly the same for me. I'm at 2751b6a, which is almost the tip of the riscv-linux-4.15 branch.
Well, my test program is single-threaded so that should not be an issue. The ENOSYS seems like a much more likely candidate. :-) |
I did another test program which I compiled with #include <stdio.h>
void *__wrap__dl_vdso_vsym(const char *a, void *b)
{
void *p;
void *(*real_dl_vdso_vsym) (const char *name, void *version) =
(void*)0x1057e;
printf(">>VDSO_VSYM \"%s\"\n", a);
p = real_dl_vdso_vsym(a, b);
printf("<<VDSO_VSYM \"%s\" %p\n", a, p);
return p;
}
int main()
{
__builtin___clear_cache(main, main);
return 0;
} The address
So yes, |
I checked the disassembly of
So unlike the code you pasted, there is no fallback to So it all points to the actual VDSO being called, which in turn makes an unsupported system call? I reran strace with
0x2000000844 is 8 bytes after the address returned by |
Hm, I think I see the problem. In #undef __SYSCALL
#define __SYSCALL(nr, call) [nr] = (call),
void *sys_call_table[__NR_syscalls] = {
[0 ... __NR_syscalls - 1] = sys_ni_syscall,
#include <asm/unistd.h>
};
|
I removed the include guard from |
Nice. Palmer, can you incorporate this fix?
…On Wed, Jul 11, 2018 at 3:06 PM Marcus Comstedt ***@***.***> wrote:
I removed the include guard from arch/riscv/include/uapi/asm/syscalls.h
and rebuilt the kernel. Now the test program works correctly. 😀
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#140 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AA-7wkxqXthi_ZgeWk-YcFhYmzli__Imks5uFnb9gaJpZM4VLlik>
.
|
It appears that the flush_icache VDSO is not working correctly on Freedom U540.
The following test program:
prints "3 3" when run on the HiFive Unleashed, but should print "3 7".
I'm building the kernel from the riscv-linux-4.15 branch.
The text was updated successfully, but these errors were encountered: