Received: by 10.213.65.68 with SMTP id h4csp577526imn; Tue, 20 Mar 2018 10:02:07 -0700 (PDT) X-Google-Smtp-Source: AG47ELusXkXds3ZmVlWMw5kDSlq4I4z0xcVKeXFZtPUTmP8EN5ezas546xnSgCc11RKA25Js1QVc X-Received: by 10.101.101.139 with SMTP id u11mr6555284pgv.436.1521565327077; Tue, 20 Mar 2018 10:02:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521565327; cv=none; d=google.com; s=arc-20160816; b=nnAthhHhUG2sWJV2s0xvDeAEOKkCLg5CsdIoleqhWIFjefLPaAshWOvLPeAtTSpe18 hz1nKwUXLF98ZfU82kR5MVIUbtcxnnskXKhoIKWBc+TWaUW2S9xEZi9ld+V3h3wypwN2 V/rlbfrSC5KNKy4kyn6oVxipuI/qA0q8YqXH01iHSWxzSIz+70kSa0c7moJlysMRaMlO k//kwbqgqyr4DY1Ab/8+4KpwqpeOQ6Jsz1NYrZQDKWCTOgaUgluE9/8zviYghJ93vZez 1Ct88cSyOV82Y25GfveDSMQhE8pjdW8FLpLFQsLyJ8xfIXL1VdLx6nlPQemo8YSOvzFm eDXw== 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:arc-authentication-results; bh=J4Z2rZEir19AjuL5VQx89ZYFVlR83h2mOMqUoqaBNGk=; b=kcUy9sPxeFgcP0+1vPH8Ng8j0I5oGRV5ZydRI2D2pmBXSLBM/5EMxJkMbjyVcz/dbR WWJG0EmD48ILy3LqwF5RbWrKbqPuA5wD9bw/cf5Ava1qfVl6l1nLiCEvtu447upWC/ru q43dfFwG45OiAZJiGyuHFtqxrB339BJA+fpmeF4JBtvp27zG0NUP1tJMU5OyZ2nOr0Zf gaR3im+TDkpwk7kT7ZAYirZK7g6GSqha8/AEmSkMK63pZh64SoYh6E7lUgOSQssqtvlu ChpjMGzEYrSacDsZDr26pgZ+kH97BS5bwsdBCQN6a9Uiwq78WYjORSlxhW4GctgjBqQ7 rQbQ== 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=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w5si1436418pgm.362.2018.03.20.10.01.39; Tue, 20 Mar 2018 10:02:07 -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; 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=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751505AbeCTRAP (ORCPT + 99 others); Tue, 20 Mar 2018 13:00:15 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:59501 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751186AbeCTRAO (ORCPT ); Tue, 20 Mar 2018 13:00:14 -0400 Received: from [187.121.16.17] (helo=calabresa) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1eyKcO-0006xP-Bo; Tue, 20 Mar 2018 17:00:12 +0000 Date: Tue, 20 Mar 2018 14:00:03 -0300 From: Thadeu Lima de Souza Cascardo To: Yonghong Song Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Borkmann , Alexei Starovoitov Subject: Re: [PATCH] test_bpf: Fix testing with CONFIG_BPF_JIT_ALWAYS_ON=y on other arches Message-ID: <20180320170001.GC3632@calabresa> References: <20180320125851.19650-1-cascardo@canonical.com> <4a497245-1864-3036-074e-107134e4b9b5@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4a497245-1864-3036-074e-107134e4b9b5@fb.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 20, 2018 at 09:05:15AM -0700, Yonghong Song wrote: > > > On 3/20/18 5:58 AM, Thadeu Lima de Souza Cascardo wrote: > > Function bpf_fill_maxinsns11 is designed to not be able to be JITed on > > x86_64. So, it fails when CONFIG_BPF_JIT_ALWAYS_ON=y, and > > commit 09584b406742 ("bpf: fix selftests/bpf test_kmod.sh failure when > > CONFIG_BPF_JIT_ALWAYS_ON=y") makes sure that failure is detected on that > > case. > > > > However, it does not fail on other architectures, which have a different > > JIT compiler design. So, test_bpf has started to fail to load on those. > > Here, you mentioned that it did not fail on other architectures. Have you > verified all of them or just looked through the algorithm. From our testing, I know at least I get an UNEXPECTED_PASS on arm64, arm, s390x and ppc64le. i386 doesn't have JIT, so it doesn't have CONFIG_BPF_JIT_ALWAYS_ON=y. > > Could you give a little bit details about other architectures are okay while > x86 is not? Maybe, x86 JIT can be improved some how? As the comment on that functions says: /* Hits 70 passes on x86_64, so cannot get JITed there. */ And looking at x86_64 JIT compiler, you will notice it's looping trying to minimize the size of the code, limited to 10 passes. If it does not converge, it goes back to the non-JIT code. That's not the case on powerpc or arm, that do not do multiple passes. sparc seem to do 3 passes, but does not seem to go back to non-JIT code. Cascardo. > > Thanks! > > > > > After this fix, test_bpf loads fine on both x86_64 and ppc64el. > > > > Fixes: 09584b406742 ("bpf: fix selftests/bpf test_kmod.sh failure when CONFIG_BPF_JIT_ALWAYS_ON=y") > > Signed-off-by: Thadeu Lima de Souza Cascardo > > --- > > lib/test_bpf.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/lib/test_bpf.c b/lib/test_bpf.c > > index 2efb213716faa..3e9335493fe49 100644 > > --- a/lib/test_bpf.c > > +++ b/lib/test_bpf.c > > @@ -5467,7 +5467,7 @@ static struct bpf_test tests[] = { > > { > > "BPF_MAXINSNS: Jump, gap, jump, ...", > > { }, > > -#ifdef CONFIG_BPF_JIT_ALWAYS_ON > > +#if defined(CONFIG_BPF_JIT_ALWAYS_ON) && defined(CONFIG_X86) > > CLASSIC | FLAG_NO_DATA | FLAG_EXPECTED_FAIL, > > #else > > CLASSIC | FLAG_NO_DATA, > >