Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2027881ybl; Thu, 5 Dec 2019 10:44:40 -0800 (PST) X-Google-Smtp-Source: APXvYqztO4txjl/dHL5/JMK7pi0D0uAUlqn4SY3vgQ8jHC7yXhaO4fDixnJdPpHLRPPz54hDSNPu X-Received: by 2002:a05:6808:a83:: with SMTP id q3mr8993975oij.0.1575571480602; Thu, 05 Dec 2019 10:44:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575571480; cv=none; d=google.com; s=arc-20160816; b=jefJDzw0rzl6bGoi14vXYwfucZBHRV7J5F3jMx+NfDjE7VEZLeuKmanIrLCm+jzC1d gGYHWQCmNdvurEJ2jsb69A2mkr7F/Z0tyaBlAqjrYCew28ID/CyoO7rRUT7zchAOA4PR d33f6kbSXBKIUBQKRULZ1h/yXiQ85xJ8RFI4WqlDpKATo+bSVzCAsQtjpaClzNrHiF57 bo9p09Ky1oKzlyVkE9QSuwbrYFa1lNBRRwvjX1+mf6lFsnvauwsTtA2AngIWUDdxzlbc xOGYvwnjAqukS6FLFce35VobdrlwJBUGZgiuG52Jpc4EiYM/5tCFj+Abpk2lotlza7R4 +mvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=FCp49Ui27dydwY8694hG4UdI57V9y5xaYI+0ibAx9Mc=; b=jeLYhxnay9fKaGSnd/NTPToCmlVJfyW9wIMRh6ITiduufd2cVh8gFZk3xDPoXiebbH Qx0lLBZXn2etTunBCCQbjUN3TE2v81oe7HFb3ArCGovss+cYsmuuFUPonT7OEM0uwYP5 fb1Qb6Ee1ZzS2LbZlECGk/2jdmIl/pgD8G8HJw2GoOTsc7IuvqrB0bZlnhvGtziWEpXj EqLOU+f76v8aG95isPav4sqbi4k5p5QeoHgCyoUKQObJjW42PvazIm10iU+u+Al3wnbs d3IOkpldH53P9mORTKhFTTg4uZv3nGA8pYkp01ApbLVRvSEqkxvpdYv3qhQHcHilTfzs Eiog== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p69si5634317oic.32.2019.12.05.10.44.27; Thu, 05 Dec 2019 10:44:40 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729685AbfLESn7 (ORCPT + 99 others); Thu, 5 Dec 2019 13:43:59 -0500 Received: from mail-pl1-f194.google.com ([209.85.214.194]:36787 "EHLO mail-pl1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbfLESn7 (ORCPT ); Thu, 5 Dec 2019 13:43:59 -0500 Received: by mail-pl1-f194.google.com with SMTP id k20so1605071pls.3; Thu, 05 Dec 2019 10:43:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FCp49Ui27dydwY8694hG4UdI57V9y5xaYI+0ibAx9Mc=; b=EwfdDzeJebLnKRGKcgosgHey0wK42t0sQk9CWjBY+NVVlAlon+T2fEoqLBaEy1HPlm 1Ri4tZacXbJy/6Se+pXlXRSyqyWISZlgfR0tYvZ9YFMrX29wvt4WUYNhjD0W5PL+puhg upOMLVdycTmy3Et4J8+t2i/FldEusxTr3XIc1oWKFvAe03nrUey9uUzzCGc3K8UHL74A 8tQyIuYY7AOM3R/4/xX7pkDg7SZc5Eq75AX8LQnnJcJRg/gXQt+L4EAV83L8BDsFr9IK hZTSQBqtUo3mDpHYt1Gxzkmq+CYURP3lukQHxSyYOZ94cUsHr1cNNEAak2GN1yUWt+QL iHNw== X-Gm-Message-State: APjAAAVYeWv45aEyP5zMaEMhQqYoSorxaTokpTjGi+9kI59PAJRo7FxO fxmMQtYFF4BgAAIqT8QHxms= X-Received: by 2002:a17:90a:23a9:: with SMTP id g38mr11278130pje.128.1575571438433; Thu, 05 Dec 2019 10:43:58 -0800 (PST) Received: from localhost ([2601:646:8a00:9810:5af3:56d9:f882:39d4]) by smtp.gmail.com with ESMTPSA id p68sm13748345pfp.149.2019.12.05.10.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2019 10:43:57 -0800 (PST) Date: Thu, 5 Dec 2019 10:44:50 -0800 From: Paul Burton To: Alexander Lobakin Cc: Paul Burton , Hassan Naveed , Ralf Baechle , James Hogan , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: MIPS eBPF JIT support on pre-32R2 Message-ID: <20191205184450.lbrkenmursz4zpdm@lantea.localdomain> References: <09d713a59665d745e21d021deeaebe0a@dlink.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <09d713a59665d745e21d021deeaebe0a@dlink.ru> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Alexander, On Thu, Dec 05, 2019 at 03:45:27PM +0300, Alexander Lobakin wrote: > Hey all, > > I'm writing about lines arch/mips/net/ebpf_jit.c:1806-1807: > > if (!prog->jit_requested || MIPS_ISA_REV < 2) > return prog; > > Do pre-32R2 architectures (32R1, maybe even R3000-like) actually support > this eBPF JIT code? No, they don't; the eBPF JIT makes unconditional use of at least the (d)ins & (d)ext instructions which were added in MIPSr2, so it would result in reserved instruction exceptions & panics if enabled on pre-MIPSr2 CPUs. > If they do, then the condition 'MIPS_ISA_REV < 2' > should be removed as it is always true for them and tells CC to remove > JIT completely. > > If they don't support instructions from this JIT, then the line > arch/mips/Kconfig:50: > > select HAVE_EBPF_JIT if (!CPU_MICROMIPS) > > should be changed to something like: > > select HAVE_EBPF_JIT if !CPU_MICROMIPS && TARGET_ISA_REV >= 2 > > (and then the mentioned 'if' condition would become redundant) Good spot; I agree entirely, this dependency should be reflected in Kconfig. > At the moment it is possible to build a kernel without both JIT and > interpreter, but with CONFIG_BPF_SYSCALL=y (what should not be allowed > I suppose?) within the following configuration: > > - select any pre-32R2 CPU (e.g. CONFIG_CPU_MIPS32_R1); > - enable CONFIG_BPF_JIT (CONFIG_MIPS_EBPF_JIT will be autoselected); > - enable CONFIG_BPF_JIT_ALWAYS_ON (this removes BPF interpreter from > the system). > > I may prepare a proper patch by myself if needed (after clarification). That would be great, thanks! One thing to note is that I hope we'll restore the cBPF JIT with this patch: https://lore.kernel.org/linux-mips/20191205182318.2761605-1-paulburton@kernel.org/T/#u The cBPF JIT looks like it should work on older pre-MIPSr2 CPUs, so the only way this is relevant is that your patch might have a minor conflict. But I thought I'd mention it anyway :) Thanks, Paul