Re: [RFC v2] MIPS: R5900: Workaround exception NOP execution bug (FLX05)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Maciej,

>  I didn't comment on the erratum workaround addressing speculative 
> execution beyond ERET, because I haven't made final conclusions as to code 
> will have to exactly look like.

OK.

>  However please note that in reality 5 NOPs are not required in these 
> generated handlers (except perhaps from the interrupt handler, which will 
> have to be double-checked, due to being set up differently), because the 
> lone reason for them to be inserted is to prevent from data interpreted as 
> ill-formed code being speculatively executed.  But any handler that 
> follows does not contain ill-formed code and the `tlb_handler' buffer is 
> cleared before any generated machine code is built within, so any trailing 
> padding uses the encoding of NOP.  Which means you can exclude these 5 
> NOPs from calculation.

Sure, makes sense.

> Substitute `mips:5900' for `mips:isa32r2' to get R5900 disassembly.  If 
> you want to see raw machine code too, use `disassemble -r', but watch out 
> for the syntax, which is different.  As you can see the trailing NOPs 
> required are already there. :)

Due to trailing zeroes, I suppose. :)

> You can supply `vmlinux' as the executable to debug too for symbolic
> access.
> 
>  You can also ask the kernel to dump generated handlers to the kernel log 
> (and the console, if `debug' has been specified as a kernel parameter) at 
> bootstrap by building tlbex.c and/or page.c with -DDEBUG, e.g.:
> 
> $ make CFLAGS_tlbex.o=-DDEBUG vmlinux
> 
> It can help if a bug in a generated handler prevents the kernel from 
> starting userland.

Thank you for these tips. Eventually I'd like to make use of kernel tracing
features, BPF (MIPS JIT seems to require a 64 bit kernel though), dynamic
debug, etc.

>  A handler for SIO is needed if SIOInt can be asserted without kernel 
> control by PS/2 hardware.  Otherwise handlers will only be needed once the 
> kernel has means to enable the respective exceptions.

Serial I/O requires soldering for the PS2. Jürgen Urban, Rick Gaiser, and
others have it and they can more easily debug the early boot stages. The
proposed PS2 serial driver uses a 20 ms timer and polling instead of SIOInt:

https://github.com/frno7/linux/blob/ps2-v4.15-n7/drivers/tty/serial/ps2-uart.c

I don't have a serial port. My setup consists of ssh over a wireless RT3070*
USB device. Obviously a great number of things could potentially fail in
that chain but it is surprisingly reliable. :)

* A few hardcoded DMA buffer sizes in the RT3070 driver have to be made
  smaller since PS2 IOP DMA memory is limited to 256 KiB. It would be nice
  if USB drivers could adjust themselves to the amount of available memory,
  or make it configurable.

Fredrik


[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux