On Tue, Sep 12, 2023 at 4:17 PM Puranjay Mohan <puranjay12@xxxxxxxxx> wrote: > > On Wed, Sep 13, 2023 at 1:04 AM Russell King (Oracle) > <linux@xxxxxxxxxxxxxxx> wrote: > > > > On Tue, Sep 12, 2023 at 10:46:53PM +0000, Puranjay Mohan wrote: > > > The JITs should not depend on the verifier for zero extending the upper > > > 32 bits of the destination register when loading a byte, half-word, or > > > word. > > > > > > A following patch will make the verifier stop patching zext instructions > > > after LDX. > > > > This was introduced by: > > > > 163541e6ba34 ("arm: bpf: eliminate zero extension code-gen") > > > > along with an additional function. So three points: > > > > 1) the commit should probably explain why it has now become undesirable > > to access this verifier state, whereas it appears it was explicitly > > added to permit this optimisation. > > I added some details in the cover letter. > > For the complete discussion see: [1] > > > 2) you state that jits should not depend on this state, but the above > > commit adds more references than you're removing, so aren't there still > > references to the verifier remaining after this patch? I count a total > > of 10, and the patch below removes three. > > The JITs should not depend on this state for LDX (loading > a B/H/W. > This patch removes the usage only for LDX. > > > 3) what about the bpf_jit_needs_zext() function that was added to > > support the export of this zext state? > > That is still applicable, The verifier will still emit zext > instructions for other > instructions like BPF_ALU / BPF_ALU64 > > > > > Essentially, the logic stated in the commit message doesn't seem to be > > reflected by the proposed code change. > > I will try to provide more information. > Currently I have asked Alexei if we really need this in [2]. > I still think this optimization is useful and we should keep it. Right. subreg tracking is indeed functional for narrow loads. Let's drop this patch set.