Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1269680ybi; Fri, 31 May 2019 17:11:13 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDCE8ulkdLGB6cc/GCtrGkb2eRp4iFPRcw69MBOY1mv6jy4kn7xboap7zGVGOCm7gvp8Le X-Received: by 2002:a17:90a:30a1:: with SMTP id h30mr12960800pjb.14.1559347873667; Fri, 31 May 2019 17:11:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559347873; cv=none; d=google.com; s=arc-20160816; b=M/IJR2ca3ZoRIpvb5F8/mc1Lo2+YoNuYM5qEtyDWrRP2FBNzFi55NWHxffxreMlzTL QEp9fgcFjsp1TwwrmHtclOggSQQynr7ewLr87TYNiaEXWVJ89QN2YngdWEtwq5nHBQGj heQ2uO8Qny2icw2DcTsv+LqsL1gAK2Kpm7NA2WFByU3/VPB1hdmFxUrr9z3gwUF0py24 1j4K8ZoLTwkvLq/CWAkb1EBz6YjOV0XM4cHkMlxUGFhHboEfTehLPlougtjB1qt8zBU2 e9v+Ql+L7FSvgEKqu0Q/wxl1N5ohDGdPDeYD+cf4HxmGeTLI+LVMliM91CucJrc3kacb WAqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=0O5y3zxJLjO+OFcgaKEEvfFc20FWAOhAiAEXszX5msk=; b=Rjea84KPfJ3lK5bRt6rVo+amLMtoyEW7oK5+vAFm3Ssdi3XCqXzOxPVhxx41dpC5rF o5NaBoXA8KcMOGkb8Tgi1y7NVTlsjimM3jgAlmzZgFjsp1Zu4BXklhFRbri+Dua3ssyP cCD6hD7DL0xcOibFA+MKejxKuOKrkBQCqBljJT93LQEGbu99wJJIn7U9E5iq0K8yR+6F m6VtLfziXcTTsTT3GMgGe0/eNQM/Mk48Iej7jBL1c8WmFNFTER2IiAk0+E4RALqL9urV TeoO+NFhcOoqqcO5Jhz5Pg2L3YiuuK2LEiSvaaRsTe71ihsiXesZe4RdQFm0Df/xXIdW tIIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="f5/IYJMd"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q6si7880537pll.226.2019.05.31.17.10.58; Fri, 31 May 2019 17:11:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="f5/IYJMd"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727174AbfFAAJx (ORCPT + 99 others); Fri, 31 May 2019 20:09:53 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:46151 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbfFAAJx (ORCPT ); Fri, 31 May 2019 20:09:53 -0400 Received: by mail-lf1-f65.google.com with SMTP id l26so9241369lfh.13; Fri, 31 May 2019 17:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0O5y3zxJLjO+OFcgaKEEvfFc20FWAOhAiAEXszX5msk=; b=f5/IYJMd1LneyL+J8KijD7RhbM6Yv+/UjfPlJ+IyfR71JYrZTBHIcgcWhxj0ZuSFlf OauU4xnS3yObYtej+TYeCNAHUc0owB/GmIiqSBLtmyHob8WcFJCYzY0hQfgSN9BL2n5p v+lnk7bSk7FN1Qb9sPdaunp6cSpccBktCTJkRJAS+SIbDC2qXdTWi9waHRWvw2ygwVNq CKpkGopD9kC46BNoVHj3CrsEf3iMh6sLgkVk7DiFXGWSSRyMXnySyghedmX95SQ9bH/Y lIFXXm+3cSwEUKsCaPH4ApA8BwjqYp95fkGqEw0Rh4PuTj/3apztACv2b7RDKJyBN9xQ vt4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0O5y3zxJLjO+OFcgaKEEvfFc20FWAOhAiAEXszX5msk=; b=RZDXEXNaz4ZCZNcgwakqbQ7r4jDKY6QA0dm/eDU+N+s9ckP85l695CjhnAL9PicSPU L8hSUQf5cZ+kVh4ileXLd9KAM1x7LzVsI02X2brJyOsprqSL+jqiIiuNyfvQSUm6etzc ZqEHIeYYAY0iQQTUh6Gd1783KcOnuTfFHyD8QS55mbBG3Qo/kiR+etcoLyXKl+VWnMmG ngpuAU+9YtYw/UYgGL1Xgdpvg/HnOWkfum0Us0nlS2122zPqDGjcGvERRzXLy3kNbQdw qZUEBJmfsULZbwbJyEhQ3V6ZokjAL6naYymvDb4cPXXFJ/vMKqzY5EJXRAfH1SuU8a4+ DAXA== X-Gm-Message-State: APjAAAUSr7JgF+I0cPYpRhVrVQAEDaAIJBg1i65sF1VMHK4ISFZS7LuR KqzZaVHFzmDbeUAK5llIU4qDRTATNT+JPqGuQUY= X-Received: by 2002:ac2:5337:: with SMTP id f23mr7428221lfh.15.1559347790765; Fri, 31 May 2019 17:09:50 -0700 (PDT) MIME-Version: 1.0 References: <20190530222922.4269-1-luke.r.nels@gmail.com> In-Reply-To: From: Alexei Starovoitov Date: Fri, 31 May 2019 17:09:39 -0700 Message-ID: Subject: Re: [PATCH bpf v2] bpf, riscv: clear high 32 bits for ALU32 add/sub/neg/lsh/rsh/arsh To: Palmer Dabbelt Cc: luke.r.nels@gmail.com, Xi Wang , =?UTF-8?B?QmrDtnJuIFTDtnBlbA==?= , aou@eecs.berkeley.edu, Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Network Development , linux-riscv@lists.infradead.org, bpf , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 31, 2019 at 1:40 PM Palmer Dabbelt wrote: > > On Thu, 30 May 2019 15:29:22 PDT (-0700), luke.r.nels@gmail.com wrote: > > In BPF, 32-bit ALU operations should zero-extend their results into > > the 64-bit registers. > > > > The current BPF JIT on RISC-V emits incorrect instructions that perform > > sign extension only (e.g., addw, subw) on 32-bit add, sub, lsh, rsh, > > arsh, and neg. This behavior diverges from the interpreter and JITs > > for other architectures. > > > > This patch fixes the bugs by performing zero extension on the destination > > register of 32-bit ALU operations. > > > > Fixes: 2353ecc6f91f ("bpf, riscv: add BPF JIT for RV64G") > > Cc: Xi Wang > > Signed-off-by: Luke Nelson > > Reviewed-by: Palmer Dabbelt > > Thanks! I'm assuming this is going in through a BPF tree and not the RISC-V > tree, but LMK if that's not the case. Applied to bpf tree. Thanks