Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp243930ybi; Fri, 31 May 2019 00:25:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqyAnM/QKL6ytEkdG43EzN+9UbINwBQt0dGZ1MZ0CmVo2LD5Adx628Gmo2C8QwdI0FJn98oD X-Received: by 2002:a63:591d:: with SMTP id n29mr7276604pgb.75.1559287527938; Fri, 31 May 2019 00:25:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559287527; cv=none; d=google.com; s=arc-20160816; b=yQ0En0BuMQbDe+hngtKXaL2gP3HfFPCXnG/yFpnWmi4A7+M9R/Xkyl5DAXtf6wn+Mh /Bac63kL0vI7otaBfsDkC6NrzxFL3W5OBajaMP39G/f2ZXUtlsRDhrJB2qzxYPDhIuIJ PCYA9/x5j30VHlmo/1yhjkEEDJvd8TvZrKgKMZOg/t47Hv/79yrePobqXO9HTx1pe4XU 9V4MbMHKMDGeMPPLsTsxniQWfivSBRDkLNNwEcmyiPbgiJMI7CA5JNEvBwnkTo9tAyV3 5orsbO1Xqp8uoR3KaP6Q4KC2hQ4uK4QOP/cCpBA/XpnGc75gF0LuI/Gupj5MhEa/vWFO b5Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:in-reply-to :subject:cc:to:from:user-agent:references:dkim-signature; bh=FU04xAR/6h4GqcGgE+2NWUuxq5FrKtSed1UqhDep54o=; b=XOJdp4Sys/vlEOJZ01ThvaDE8vUzt58e3nK3nmFf9lrXTmiUEkmjCn2fL840kBz60/ 1dSZH9/iDms1aDC6CIyrRW68X+pcf9M7BRCiRLyEgMFm7xqJtYCRfqdH9IXXyrB2nOSI shnHkhQIytan5FL8/MTNBgxQSmhrpKBwcKWk4u+8HO+mupLA/g3tgB9IlFqpytFXH8/e QWV1aoJTzCKTYxRSZUNY/KqkNKBAXEBv0ak7lFLAMAIa0x+DjuVsTH6eVQhvEDJX9WX/ iN/pSgfFAp/anIpI39p9a7QP5FAQpEFuD2GU17hKyULNlb5YWt1HmHuOzNsBvNU0oPcr NUhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=eeJoMp9B; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v3si4871930plo.329.2019.05.31.00.25.11; Fri, 31 May 2019 00:25:27 -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=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=eeJoMp9B; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726803AbfEaHW4 (ORCPT + 99 others); Fri, 31 May 2019 03:22:56 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52870 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726275AbfEaHWx (ORCPT ); Fri, 31 May 2019 03:22:53 -0400 Received: by mail-wm1-f68.google.com with SMTP id y3so5335961wmm.2 for ; Fri, 31 May 2019 00:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=references:user-agent:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=FU04xAR/6h4GqcGgE+2NWUuxq5FrKtSed1UqhDep54o=; b=eeJoMp9B+3CUiDjzCQewpNM5ilfXaCzT/ghPtaG5Ck6HrGBJV9s9ZczKJw/NtzJPdO 7S1gIefCcFM4pZPgMB6f82Tvc/mF1tKoe5uQI+OZ2UETFek+Gk7KiNEDbh6cfSdUQ0v4 guUzuTpUsUHhBs5iSjQavC6RwG/JxRX/5+dsSAv7VZQlWWA+ubIca8ZlwbGGNrG3NSUM 8nSWcOhABep4I6s0gPveUTmp1yYvLflDZ84droGjHq/a5gLcZ5GEMaVjlg0MLAjNEEaq dCtVG0GgEnJzOKR3BFm1g40CdC6X6JcTwxV4+1PcUU7k+IbpYFBDTw8Tni4aVoIczFgc AzGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:date:message-id:mime-version; bh=FU04xAR/6h4GqcGgE+2NWUuxq5FrKtSed1UqhDep54o=; b=RZw5hPHx3zps3+8UwuFzQSjgRpKgdFawqB1g+NbUyAzP166U+rp1qJ33BZUCW79lZa TVk8V1UDGLqF6A/fKWzOc8vrQTJkwZrobXTBidN7uS7/DJ6MsweClnIxr5H6PUiBuubi jc8eBg6wSXz8c1iXXKxKHNdoxLP2quD/NENpFO2atVTvBn0HO6otXkS1Bm8SwrD81TeG WM2v+auHJOCvjCrcjd2XSKCBJ8W9//xhPG2azWb8gE9jWsTa5A8OUeHRzVl4ab2OHzO6 THkPQJR8QesxDTVThy1FUqaeNrJVcBlXaoZSNgJRLNeIjbt3OFXrV4+G8RtEAiWHXkcz nT+Q== X-Gm-Message-State: APjAAAVnv7SuI3w+OR6NbXbmwr63A+Cs7PFg9eMPusicEQKQxLmdQxcU rCAKRfGgNVdz+telSEyGWTje2kk0WGs= X-Received: by 2002:a1c:2358:: with SMTP id j85mr4678026wmj.46.1559287371059; Fri, 31 May 2019 00:22:51 -0700 (PDT) Received: from LAPTOP-V3S7NLPL (cpc1-cmbg19-2-0-cust104.5-4.cable.virginm.net. [82.27.180.105]) by smtp.gmail.com with ESMTPSA id z65sm7566691wme.37.2019.05.31.00.22.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 31 May 2019 00:22:50 -0700 (PDT) References: <20190530190800.7633-1-luke.r.nels@gmail.com> User-agent: mu4e 0.9.18; emacs 25.2.2 From: Jiong Wang To: Luke Nelson , Song Liu Cc: Xi Wang , =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= , Palmer Dabbelt , Albert Ou , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Networking , linux-riscv@lists.infradead.org, bpf , open list Subject: Re: [PATCH 1/2] bpf, riscv: fix bugs in JIT for 32-bit ALU operations In-reply-to: Date: Fri, 31 May 2019 08:22:45 +0100 Message-ID: <87d0jzgkai.fsf@netronome.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Song Liu writes: > On Thu, May 30, 2019 at 3:34 PM Luke Nelson wrote: >> >> On Thu, May 30, 2019 at 1:53 PM Song Liu wrote: >> > >> > This is a little messy. How about we introduce some helper function >> > like: >> > >> > /* please find a better name... */ >> > emit_32_or_64(bool is64, const u32 insn_32, const u32 inst_64, struct >> > rv_jit_context *ctx) >> > { >> > if (is64) >> > emit(insn_64, ctx); >> > else { >> > emit(insn_32, ctx); >> > rd = xxxx; >> > emit_zext_32(rd, ctx); >> > } >> > } >> >> This same check is used throughout the file, maybe clean it up in a >> separate patch? We also need to enable the recent 32-bit opt (on bpf-next) on these missing insns, like what has been done at: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git/commit/?id=66d0d5a854a6625974e7de4b874e7934988b0ef8 Perhaps the best way is to wait this patch merged back to bpf-next, then we do two patches, the first one to enable the opt, the second one then do the re-factor. I guess this could avoid some code conflict. Regards, Jiong > > Yes, let's do follow up patch. > > Thanks, > Song