Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp982835ybt; Wed, 1 Jul 2020 15:19:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyy75kpe3YxFnCYXve/YLad2Ycolt9DRI/MbCzxZOXzQ4LPh765PJ+ZS5TJQZ6/CnMILSeX X-Received: by 2002:a17:906:4086:: with SMTP id u6mr26657653ejj.9.1593641946501; Wed, 01 Jul 2020 15:19:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593641946; cv=none; d=google.com; s=arc-20160816; b=Fb92Byvx1Yf5vWyQJ1T8UU+4glhklLTwoF8OLpvfJ+O7nKw7FdbfmnNSEpqb1Uxbje j8OJ9OPfjYMIxqCSISeO8TkvoP4cL8mVKnw8r1ChYzdtcf7OAI7DJs2RWcUrhX1IRjGY 36/oykE/niOtELopdVXaG3X3CuKACi/bleA315pUHQHrEqXKGqxHp5hpqzAZkk/EHrZr q3bjAk7kmRLjn4z4Zsu6iNSZeuBV9RgXO3XaVtBcYOBVp5o2BNnaazjOwLpgPBx0vPWz jc1ZWOAENFaYHIsXu4qQdneIgv7q55hDQaB5PwpsU/I6jRdJ8ZQbmdEk9RR6hCHIsPXq KV1A== 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=0hjOP2xWJYBFB1lJ44pZ1iwrgg794l/jK5E/p4AXI4Y=; b=BT9KXIv20pKPVEdBjLTBAc/aOPFlCyVeErYp+eecs8IG5jb8eJ5BquFOu2PmeL1QHL jaCmmwFjWiiS43hSQ1bTsqME3E8QGSqua7RM/bR27JaBQjgHkZOufs4lGqL3mJaCSpfu 0h1SJc8pIPEVrssO0SMdtb966k/tKIDgql8+tZ4KEYzljQMyGiInaIHFCUjJDJToynQW glDNQ8HspFzSDIHckf9gji4brJGeqtVkwAG+aE6HpGw+BfI9yMU2N9IV1xUxJA7D6KjX 816rdCDvqCeRyKnuu8YaPi5sRIBv28ja8SVdGNKLes65GnC6WEBRUh+7UX+MWXS+9lbF S4Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xgu2wjxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id dr2si6265448ejc.18.2020.07.01.15.18.41; Wed, 01 Jul 2020 15:19:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Xgu2wjxM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1726714AbgGAWRX (ORCPT + 99 others); Wed, 1 Jul 2020 18:17:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725771AbgGAWRV (ORCPT ); Wed, 1 Jul 2020 18:17:21 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5076BC08C5C1; Wed, 1 Jul 2020 15:17:21 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id z24so4210425ljn.8; Wed, 01 Jul 2020 15:17:21 -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=0hjOP2xWJYBFB1lJ44pZ1iwrgg794l/jK5E/p4AXI4Y=; b=Xgu2wjxM8gR3RdyappZ8oWPk1hZNwzaHxbRsdwv1ih9IYYRvRIqKdKk+NPPFJMIgGf tuGmbf6th2afvmfrQgZ17KsSvoXzw3M/DdERL+haWnWYQ/yivIh04Il/0SVpOwIJChfl nXaI+90956OkrqnzY6idFn3fR1CkNiI5oxM4OI6aNVN+5CqeuerOXeXz9wcOK4mEwFS2 U56SI4t7ivgqYcuMz2DZjhfloweXi09Cjg5M/y/YDMDXPgOxjXBlw2JdLi09TJrwyhFJ day/jgYuHZH1a/2z0VXf3QdBEoV+fYkMqyeFxhJwrcFsfZvEJ/UtDGJgzS0li4MLQMx+ A5Bg== 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=0hjOP2xWJYBFB1lJ44pZ1iwrgg794l/jK5E/p4AXI4Y=; b=tEggY2p9BWi6NCXwIeCK+9b1GLianUnoRbEoDcSz6TiF5G4PFWKBogJSjTHCFzUZdz jA0x0HknrpKx5kOH9UJ8bERPQ7cor4LnZXZKFfEWRRWp+x4xnS80aIUKRqKJdNMt0Q4d klGwKrqNFq/2RYk8pDKtqZW5Hxh/jUqBY13nJfZHXUnel06iGS8Kl3j9u+0S0ZUOvfGW 1/L9vq66m0ZY6BVj5n+SiUXrK9T5oekQLkD2gtF6Aaf6LiBryn2VgOb1x/QkvQe1aG2v WPs8/LEEL9JLPXySfxgVi4GC79K8x/BcMwhqryQW4xNqQRF0pfmCWVVCjSlpNGpP8EsU Ou9g== X-Gm-Message-State: AOAM533A/LUpocLk4YMG6jg1Ofl17r70xz+ituTUXxEWG19TwBz8owyw 8bjVbOpX6utFYI24JR0SEKLYw+PU4D8FdcWEDqg= X-Received: by 2002:a2e:9bc3:: with SMTP id w3mr6345365ljj.121.1593641839001; Wed, 01 Jul 2020 15:17:19 -0700 (PDT) MIME-Version: 1.0 References: <20200701175315.1161242-1-haoluo@google.com> In-Reply-To: From: Alexei Starovoitov Date: Wed, 1 Jul 2020 15:17:07 -0700 Message-ID: Subject: Re: [PATCH bpf-next v2] selftests/bpf: Switch test_vmlinux to use hrtimer_range_start_ns. To: Yonghong Song Cc: Hao Luo , Network Development , bpf , LKML , Clang-Built-Linux ML , Stanislav Fomichev , Shuah Khan , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , "open list:KERNEL SELFTEST FRAMEWORK" 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 Wed, Jul 1, 2020 at 11:04 AM Yonghong Song wrote: > > > > On 7/1/20 10:53 AM, Hao Luo wrote: > > The test_vmlinux test uses hrtimer_nanosleep as hook to test tracing > > programs. But in a kernel built by clang, which performs more aggresive > > inlining, that function gets inlined into its caller SyS_nanosleep. > > Therefore, even though fentry and kprobe do hook on the function, > > they aren't triggered by the call to nanosleep in the test. > > > > A possible fix is switching to use a function that is less likely to > > be inlined, such as hrtimer_range_start_ns. The EXPORT_SYMBOL functions > > shouldn't be inlined based on the description of [1], therefore safe > > to use for this test. Also the arguments of this function include the > > duration of sleep, therefore suitable for test verification. > > > > [1] af3b56289be1 time: don't inline EXPORT_SYMBOL functions > > > > Tested: > > In a clang build kernel, before this change, the test fails: > > > > test_vmlinux:PASS:skel_open 0 nsec > > test_vmlinux:PASS:skel_attach 0 nsec > > test_vmlinux:PASS:tp 0 nsec > > test_vmlinux:PASS:raw_tp 0 nsec > > test_vmlinux:PASS:tp_btf 0 nsec > > test_vmlinux:FAIL:kprobe not called > > test_vmlinux:FAIL:fentry not called > > > > After switching to hrtimer_range_start_ns, the test passes: > > > > test_vmlinux:PASS:skel_open 0 nsec > > test_vmlinux:PASS:skel_attach 0 nsec > > test_vmlinux:PASS:tp 0 nsec > > test_vmlinux:PASS:raw_tp 0 nsec > > test_vmlinux:PASS:tp_btf 0 nsec > > test_vmlinux:PASS:kprobe 0 nsec > > test_vmlinux:PASS:fentry 0 nsec > > > > Signed-off-by: Hao Luo > > Acked-by: Andrii Nakryiko > > Thanks! > Acked-by: Yonghong Song Applied. Thanks