[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAM1=_QRVEG0Fw9U99V3ohMe60h0DwMzyWvV_gYdJ=SrQ1D11Fg@mail.gmail.com>
Date: Mon, 27 Feb 2023 13:17:53 +0100
From: Johan Almbladh <johan.almbladh@...finetworks.com>
To: Jiaxun Yang <jiaxun.yang@...goat.com>
Cc: "linux-mips@...r.kernel.org" <linux-mips@...r.kernel.org>,
linux-kernel@...r.kernel.org,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
"paulburton@...nel.org" <paulburton@...nel.org>,
bpf@...r.kernel.org, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>
Subject: Re: [PATCH 1/2] MIPS: ebpf jit: Implement DADDI workarounds
On Thu, Feb 23, 2023 at 11:29 AM Jiaxun Yang <jiaxun.yang@...goat.com> wrote:
> I didn’t see any place emitting DADDI.
Right, the JIT only uses unsigned arithmetics :)
> Yes I analysed all other place, most of them are just calculating memory
> address offsets and they should never overflow. Other two is doing addition
> to zero to load immediate, which should be still fine.
Ok.
> >> --- a/arch/mips/net/bpf_jit_comp.c
> >> +++ b/arch/mips/net/bpf_jit_comp.c
> >> @@ -218,9 +218,17 @@ bool valid_alu_i(u8 op, s32 imm)
> >> /* All legal eBPF values are valid */
> >> return true;
> >> case BPF_ADD:
> >> +#ifdef CONFIG_64BIT
> >
> > DADDI/DADDIU are only available on 64-bit CPUs, so the errata would
> > only be applicable to that. No need for the CONFIG_64BIT conditional.
>
> It’s possible to compile a 32bit kernel for R4000 with CONFIG_CPU_DADDI_WORKAROUNDS
> enabled.
Yes, but DADDI/DADDIU are 64-bit instructions so they would not be
available when compiling the kernel in 32-bit mode for R4000, and
hence the workaround would not be applicable, right? If this is
correct, I would imagine CONFIG_CPU_DADDI_WORKAROUNDS itself to be
conditional on CONFIG_64BIT. That way the this relationship is
expressed once in the Kconfig file, instead of being spread out over
multiple places in the code.
Powered by blists - more mailing lists