Received: by 2002:ac0:a679:0:0:0:0:0 with SMTP id p54csp1317926imp; Fri, 22 Feb 2019 00:49:14 -0800 (PST) X-Google-Smtp-Source: AHgI3IZhnsOEkW6IXiCMnHC52LbD+64zUdRLPBehfw2zHrIJB7AjJl+JXHvXEHxEANcWvFnb56lW X-Received: by 2002:a17:902:a508:: with SMTP id s8mr2947292plq.275.1550825354790; Fri, 22 Feb 2019 00:49:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550825354; cv=none; d=google.com; s=arc-20160816; b=o0oHT05HDPpzM5MC7g3Q2EGMu1ha3nnD91MFPghh6MGPDlOGD6JcRZ8QQ7k2z5/YI5 lgP5FeHKS0QgmaeIisvYJlgm1l6sjXKIn4Ff8/I/sZGlJnIaTEtI8AlEzyYOtarTn3gf CfKCvayKNhjmR80uGtinT7Tjb1/0NxdiVdGyL9hV9F89h7XrC5vhKn4ge/PuPlwexJOG nh+YEVMbwlz7SIPjC8d5dlxjneI/n/0aBntxNK/WnSSdd0cysydWbmTfyDaO0LDoEche WM9czxv4fcs1ksJyyb4Fti7thXAN7gTHck5JBCvZJjNKvIxt4I4OesDfBLZxzxi0EKqD 0ZFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ETZpFB6qJCxlI0IxAQXLgBRS8xsxl7FpE0AKXNpfHcc=; b=lUHwnnrtmYxF8Xj9degsa9nfKj+NmpEoZvF3dm59J1CppiEbMvusDF7dMMPCHiUgeX +h2a4yrtE6mefJOXW8BiXn6Sjv7zcOSw0lyn79izW9PQtpnPyVLSQJ6nHgDc9hsemHFH W5BLTogdy6wIgto6t1V7Qz7p1RXjDNQVEU874s0yPcaCxZlu2ZA5crXmh4gynuUtZRpD 277L9+4AtE+mcUy+UC8XRXrLZdOVA4qyudLHLes0OAvdRF/3i6YMEHa2VCRlIPoCSDQu F6PN32Sg74h5wxsxNJz8yHBgr3fSv5mhMcQg2SYk0TwxOJyBK5n0607vZx4FwI+aUoOr UufQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NG8A+5zD; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17si845561pgv.328.2019.02.22.00.48.59; Fri, 22 Feb 2019 00:49:14 -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; dkim=pass header.i=@linaro.org header.s=google header.b=NG8A+5zD; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726601AbfBVIrI (ORCPT + 99 others); Fri, 22 Feb 2019 03:47:08 -0500 Received: from mail-lj1-f195.google.com ([209.85.208.195]:33456 "EHLO mail-lj1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726297AbfBVIrH (ORCPT ); Fri, 22 Feb 2019 03:47:07 -0500 Received: by mail-lj1-f195.google.com with SMTP id z7so873171lji.0 for ; Fri, 22 Feb 2019 00:47:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ETZpFB6qJCxlI0IxAQXLgBRS8xsxl7FpE0AKXNpfHcc=; b=NG8A+5zD+mICdf4JNSR355725NfBQRGbY4mWguL8wD5XfuQVzTnbFppbDUY1Yt30du ujPTECWNc43+reiXYYD6j2Uutnc23objJ2gZH6Y8cahbS12DVm061xXlJf15AAeOh31f R7/p88kS3bpBD5ngNcpr3ldlcIE/2dwfuZl/Mj9he2Q8So8/5KcZRGdDso2Ly992dmX0 peADa74zD+FZJTSE2N9oM2J8/2UnfDv15anoNydIQRqxCJ129gLQulwMbBgMFpf/jQDF tznKGpDsny73cAn9pUMnlNS0pbBrPL6U5PSwEVmf0jJXeK3UkGENYV5G0gT8rNj7KY+v 1EvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ETZpFB6qJCxlI0IxAQXLgBRS8xsxl7FpE0AKXNpfHcc=; b=Ik3tnMF5f+H2cTn1oEZJw2VgxlCY0ciOCXmx2B2NQBGlotHvR/mku8zw2SXbzH9H9l tWIfB4aQAwzsIssok4MGUZYEI5+bsQYC0/XTB07zOkgNKIWZiYxY7i9b+O0LEh1UgKKi 1VDclg4ulsJocVnJ33Pz96LQYqm63ckr68iLgZP21v+sRFZnrr6+dAT8ii2vpnPQa5My inGrB7Nr/aDyHD6rjUP6JH/LU6+JztKollxDPP+2Hkfb6Oay35LdzJi9hl009fHKmZL2 3B6tCYMtnZ5S63GSM20HxuE0tSkOCElkXvf9cDaUuTmitZ6DToySmmAclnAxaeOBcDrz C/oQ== X-Gm-Message-State: AHQUAuZE+3qOaf7rSfvPPfkZncmGl8Vbd7fI5bjIIRjQi6PzuLBs7HVj Du3ozEPGeMVIwp+7RttsxHKFqg== X-Received: by 2002:a2e:b1d1:: with SMTP id e17mr1716300lja.120.1550825225616; Fri, 22 Feb 2019 00:47:05 -0800 (PST) Received: from localhost (c-573670d5.07-21-73746f28.bbcust.telenor.se. [213.112.54.87]) by smtp.gmail.com with ESMTPSA id z26sm284506lja.33.2019.02.22.00.47.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 22 Feb 2019 00:47:05 -0800 (PST) From: Anders Roxell To: ast@kernel.org, daniel@iogearbox.net Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Anders Roxell , Arnd Bergmann Subject: [PATCH v2] bpf: test_bpf: turn of preemption in function __run_once Date: Fri, 22 Feb 2019 09:46:52 +0100 Message-Id: <20190222084652.1326-1-anders.roxell@linaro.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When running BPF test suite the following splat occurs: [ 415.930950] test_bpf: #0 TAX jited:0 [ 415.931067] BUG: assuming atomic context at lib/test_bpf.c:6674 [ 415.946169] in_atomic(): 0, irqs_disabled(): 0, pid: 11556, name: modprobe [ 415.953176] INFO: lockdep is turned off. [ 415.957207] CPU: 1 PID: 11556 Comm: modprobe Tainted: G W 5.0.0-rc7-next-20190220 #1 [ 415.966328] Hardware name: HiKey Development Board (DT) [ 415.971592] Call trace: [ 415.974069] dump_backtrace+0x0/0x160 [ 415.977761] show_stack+0x24/0x30 [ 415.981104] dump_stack+0xc8/0x114 [ 415.984534] __cant_sleep+0xf0/0x108 [ 415.988145] test_bpf_init+0x5e0/0x1000 [test_bpf] [ 415.992971] do_one_initcall+0x90/0x428 [ 415.996837] do_init_module+0x60/0x1e4 [ 416.000614] load_module+0x1de0/0x1f50 [ 416.004391] __se_sys_finit_module+0xc8/0xe0 [ 416.008691] __arm64_sys_finit_module+0x24/0x30 [ 416.013255] el0_svc_common+0x78/0x130 [ 416.017031] el0_svc_handler+0x38/0x78 [ 416.020806] el0_svc+0x8/0xc Rework so that preemption is disabled when we loop over function 'BPF_PROG_RUN(...)'. Commit 568f196756ad ("bpf: check that BPF programs run with preemption disabled") highlighted the issue. Suggested-by: Arnd Bergmann Signed-off-by: Anders Roxell --- lib/test_bpf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/test_bpf.c b/lib/test_bpf.c index f3e570722a7e..0845f635f404 100644 --- a/lib/test_bpf.c +++ b/lib/test_bpf.c @@ -6668,12 +6668,14 @@ static int __run_one(const struct bpf_prog *fp, const void *data, u64 start, finish; int ret = 0, i; + preempt_disable(); start = ktime_get_ns(); for (i = 0; i < runs; i++) ret = BPF_PROG_RUN(fp, data); finish = ktime_get_ns(); + preempt_enable(); *duration = finish - start; do_div(*duration, runs); -- 2.20.1