Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3636877rdb; Wed, 13 Sep 2023 19:49:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxC8Vy5sHc/0uR1Fm/bEBt8AXoAUXkPkXQqQ4vk3AcJ7jk8opflvS2MhK0jtgXURtZR1ID X-Received: by 2002:a05:620a:192a:b0:76f:1846:2f6b with SMTP id bj42-20020a05620a192a00b0076f18462f6bmr4659798qkb.1.1694659740391; Wed, 13 Sep 2023 19:49:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694659740; cv=none; d=google.com; s=arc-20160816; b=SanVBYmXSZ89UtjXWOOpHbVPCnwobPsGBtoYrPGAzqXxiwfsn3gnvT0ac5qoMCgRrX 94apYCV/gvXgXgvaHBWIUM/bUIJzxOk+/HT5z3Pi2UgfgwYsbIrnGLzGkqdVgUtey8Ib z8BVyEPcsYfRJM3jdBvlDXrqvJQhLyYJOVMl6Zf81o2c6oizgRws0QWOoD2uLC/oYLNH GrByAKXD7Pbr2yZysv4u4jHre3ilIL2qrPPY3l5i942iwmHUH62pJOKjgv2tf21zvw7o BerUfyrdm0hHaMFgE1SeKB+OlhHoQltMmeY5s/nErsFsGykFahym6PEehPFFECoWchbD UUgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=XrbSVU4nZUFvuKXs1rDJFefP9fH0F3hyySGPvLoP9m8=; fh=4Orkp6kw7Im7hgZp4T22e88QyZjjLWKxGIhKIUvvr/w=; b=I8PrCQEtSX26UooaV+3UpT8r6d7YrMtRnWdCRtmw/5CP6LI7pTbZQs1mjPUvs8Z1zF fdPhEgZJ3P89ePeg6dWQDY2bB/H/o9PDUu2rGZB7nzS/pcUcvwVYyOLhYYKg2vypeoSE iJf9ftcebaEeW7BEMMpUHKve4HCniYMv90AUz51iVdkg45CePZVssH6QUz/sHmx7Hiwn gXvc5tJbbfYmzbCkn0os742ofLdFvHwMf+PQc9VOTtQwxmwF7k4b16s2loVFfu/ntML2 RahSvYiArxOyNwbm4Zh+Ok7BnxOtP0OP2LdDAhR1t7XTWUMXJTFYNoINvenK/nF84s1U fDkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=YzzvrFNt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id a35-20020a631a63000000b00563d74b6347si481551pgm.863.2023.09.13.19.48.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 19:49:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=YzzvrFNt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id D6770801F121; Tue, 12 Sep 2023 16:17:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231672AbjILXRC (ORCPT + 99 others); Tue, 12 Sep 2023 19:17:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230093AbjILXRB (ORCPT ); Tue, 12 Sep 2023 19:17:01 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAD5B10F7; Tue, 12 Sep 2023 16:16:57 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id 2adb3069b0e04-500c37d479aso10100301e87.2; Tue, 12 Sep 2023 16:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694560616; x=1695165416; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=XrbSVU4nZUFvuKXs1rDJFefP9fH0F3hyySGPvLoP9m8=; b=YzzvrFNtj8Z6VMUMkRu3/32kLqhf2WWzBzG8H1YSIITP3OLuw4c+IyTIMTMHpKOjKt 25zhumNrSRpDab/8Vkxu6IZYA0W1oBeieNkhIZVWvk1Yxk2ZTRCf2Idgyxqkd5bqxDvF kMVNyINz73ncXMJl5pG5D3qfZJggauWCB4Fcsb8PLiF2gh+/TpdcmjdXWeFxntc00L29 D70UyXFrXQ2s3lMHbJKho0Qv2yLC9B596TzXduupA5oWTfYBZZZwbVNP6fAJeLFUPjEe v5ORKFPXlKIw/k2ZxWhIQtApU57xYdu0u7Hv5hNkLF4n1L9CyrgODlhnwOvW5klZdP+k LLWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694560616; x=1695165416; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XrbSVU4nZUFvuKXs1rDJFefP9fH0F3hyySGPvLoP9m8=; b=jPQ3bvX6lhsloXBm5W//dEIuzrQ8LpnuGCuMOvjPHA04th6r/MJxeMUXu0Euu1wfik 3a461pIoBpANs8KZbB/nePXEQ2gVmrqoeYvgXlKqIMs4knOHbCjoZVAqAXz7/djGcK4f bPpctOMp+eV/UdaxVfnE3pg30LF0LsESHPdFmJgW95952oroFxAayREvV0vlRLXxwXyK gN316kgSWc2Qq49penCg0FgIW0cDFeBK1cYUB4NSj9uuEPzW4QYtZNWyel+1fbgq9HSz M93WG6WTH4Pnn+crGop28zx5i+5GSMeq0vEPDL4aJDhqBFcfWFMtRy5dOD0/1GnKj32q V/bw== X-Gm-Message-State: AOJu0YzUv9ELVuOxcqStVXnbU/oeCS2XG+zEdUNu963w7xcg4IV00/YQ Yx7JwyHVuApCmraJrOYUTLGGIKZd6LGA7Ol47ZI= X-Received: by 2002:a05:6512:31c3:b0:500:a694:46f with SMTP id j3-20020a05651231c300b00500a694046fmr951572lfe.19.1694560615656; Tue, 12 Sep 2023 16:16:55 -0700 (PDT) MIME-Version: 1.0 References: <20230912224654.6556-1-puranjay12@gmail.com> <20230912224654.6556-6-puranjay12@gmail.com> In-Reply-To: From: Puranjay Mohan Date: Wed, 13 Sep 2023 01:16:44 +0200 Message-ID: Subject: Re: [PATCH bpf-next 5/6] bpf, arm32: Always zero extend for LDX with B/H/W To: "Russell King (Oracle)" Cc: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shubham Bansal , "James E.J. Bottomley" , Helge Deller , "Naveen N. Rao" , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Luke Nelson , Xi Wang , Paul Walmsley , Palmer Dabbelt , Albert Ou , Wang YanQing , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, netdev@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Tue, 12 Sep 2023 16:17:03 -0700 (PDT) On Wed, Sep 13, 2023 at 1:04=E2=80=AFAM Russell King (Oracle) 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 instruction= s > > 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. Thanks, Puranjay [1] https://lore.kernel.org/all/CANk7y0j2f-gPgZwd+YfTL71-6wfvky+f=3DkBC_ccq= sS0EHAysyA@mail.gmail.com/ [2] https://lore.kernel.org/bpf/CANk7y0hK9sQJ-kRx3nQpVJSxpP=3DNzzFaLitOYq8= =3DPb6Dvk9fpg@mail.gmail.com/