Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp105829ybt; Tue, 30 Jun 2020 15:50:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypjrDPhIJ9qdlWlE0usW1pZeiAMYqtV0zUGE0kyQ91nSvYTZ9OIls74TpE6v3v/iJJZZQE X-Received: by 2002:a17:906:c415:: with SMTP id u21mr19977510ejz.45.1593557403280; Tue, 30 Jun 2020 15:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593557403; cv=none; d=google.com; s=arc-20160816; b=y584VVmAdVbOpM6isDjAPe6ACx7r1nXbH/kvBgi6WmntRle1TIHt+mPvTOZG2xfecO quru/CNrwuQQcCzDP3pWYsCmGssL6oiwW/MvEAO34Zsaal7IVrPH5ZRjpN8jGtqFLDtr UiQQc58Dz6VLNS1lj8uye4ukLrvPPSFa/GNxrybzWSM0rEWifvMxmI3INSHE70TM20U6 ghbb3iDAPjhLkASHPFR5yAichA96ux9N7ghPcLo41YfpysB7xPgnmH6Aa45KSlSPZO3G Fuvv7p4Im82OQNfz38wsSXV4FBQofwtoMQjfEFqMXueIF0twS5qTiXGjlw9HUQOycIEI K/xQ== 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=s3xaSnjPwOz/gfRv2/K99Xg/qf7pM+PnO4Lm4xuaoC0=; b=t/0UBrkWM1ny5wdu9MAyNgAnNH7SkkaY+6pE8SjAvfcPdroWpQRx1KMGfprw8vvmXO oLP1wqANQnQ73Yq2xKEDWMFyO9WKTWpwN8LpuKOMIFNoKq9Akf8vC152ksUlTAzKlKYe kgRvOjp8LEnsiXIxIDe8F+bAtOQGtQOssHeeFflPzvMd1luwqaKN5kNvFEfeSerEUR9e hcKMLMWoZEJYKnu8dItit5wc/FKxfuXWthGULnHUjY2E5tbgyZGM3CvdNp8Zz/XtGqAi arJNOWhkxREE+mMHa6l4ESdjFs5PBbV1plJ7kuva3nc1vnztZO6fhudvcKRDth6J1Z2t a5NQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ASbXZJLt; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si2620978edq.200.2020.06.30.15.49.40; Tue, 30 Jun 2020 15:50:03 -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=@google.com header.s=20161025 header.b=ASbXZJLt; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726305AbgF3Ws5 (ORCPT + 99 others); Tue, 30 Jun 2020 18:48:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726072AbgF3Ws4 (ORCPT ); Tue, 30 Jun 2020 18:48:56 -0400 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28D0EC03E979 for ; Tue, 30 Jun 2020 15:48:56 -0700 (PDT) Received: by mail-ed1-x542.google.com with SMTP id h28so17836858edz.0 for ; Tue, 30 Jun 2020 15:48:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=s3xaSnjPwOz/gfRv2/K99Xg/qf7pM+PnO4Lm4xuaoC0=; b=ASbXZJLtG8XUPSKV+h/SVuJS8yIbMCdkYnwmz9GVGBHSAM+DAluDsY/UItNHh5PPjN ojeIFIQdrQrB5TO+YJ4T17S3IX4uNxtZRu3ECARMr+8G3RfHGY0MFD8NQQoegMH9WYgw DplT/XHY6xm7t+KEUlRVK5cBeygKp2aVxTDa84GvXZysfxGk/Hd43n9zJJmazHKD3iF7 MSte5VrVqWlbM/EjzGkN8q90OIsCct0GzstiUZJV+IHJlsi4kupmFdqViSPPqCacYpia CJDgVFsqebVGLJTdh2JQ2zFzHI2FGtHwawNpHLQReD555gWw11/dCwr4oRXqFYgLWD0/ 0J0w== 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=s3xaSnjPwOz/gfRv2/K99Xg/qf7pM+PnO4Lm4xuaoC0=; b=oXuclg9jf+5doi1Lp/RlDXaAIxJAoAs2plP+9AWl64H1aXdz2hVVLt21nDF6GhAJJ8 weYLIu/5LNwwLvk2N7A9VYR5YqlM3/ikU64YW5IgYszwg+a6BkESKBsbLiPK7rQigymB EEidEvKkbcFlmxPYXNLfeo8J0sXRsftPLXASXJGNdJsly6PX3NERkV1mdBCUpGlaI/KS yFMBsfo+IsRoEAYhKoxi/1iyq4DgISsbu7zhS7cMWvIDSz4BPnK9YXINXG2ii7UkqxKD Usd3rENZUIn+PLaTuquWeZqOHbiAhw1rxURPMsq+LVeaX0etVAnSYUyADO2oXfMZgMyg pb9g== X-Gm-Message-State: AOAM530IPK3/675uGN91DfaD7gikkjuwp51Yfw2uU1e0i6WmEj2RbBqT N06q4/ixKO0IiCMJAoMhLXI6n3Kc+CH9ypnqXbQ0FQ== X-Received: by 2002:aa7:d5cd:: with SMTP id d13mr691466eds.370.1593557334562; Tue, 30 Jun 2020 15:48:54 -0700 (PDT) MIME-Version: 1.0 References: <20200630184922.455439-1-haoluo@google.com> <49df8306-ecc7-b979-d887-b023275e4842@fb.com> In-Reply-To: <49df8306-ecc7-b979-d887-b023275e4842@fb.com> From: Hao Luo Date: Tue, 30 Jun 2020 15:48:43 -0700 Message-ID: Subject: Re: [PATCH bpf-next] selftests/bpf: Switch test_vmlinux to use hrtimer_range_start_ns. To: Yonghong Song Cc: Networking , bpf , linux-kernel@vger.kernel.org, clang-built-linux@googlegroups.com, linux-kselftest@vger.kernel.org, Stanislav Fomichev , Shuah Khan , Alexei Starovoitov , Andrii Nakryiko , Daniel Borkmann , Martin KaFai Lau , Song Liu , John Fastabend , KP Singh , Bill Wendling 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 Tue, Jun 30, 2020 at 1:37 PM Yonghong Song wrote: > > On 6/30/20 11:49 AM, Hao Luo wrote: > > The test_vmlinux test uses hrtimer_nanosleep as hook to test tracing > > programs. But it seems Clang may have done an aggressive optimization, > > causing fentry and kprobe to not hook on this function properly on a > > Clang build kernel. > > Could you explain why it does not on clang built kernel? How did you > build the kernel? Did you use [thin]lto? > > hrtimer_nanosleep is a global function who is called in several > different files. I am curious how clang optimization can make > function disappear, or make its function signature change, or > rename the function? > Yonghong, We didn't enable LTO. It also puzzled me. But I can confirm those fentry/kprobe test failures via many different experiments I've done. After talking to my colleague on kernel compiling tools (Bill, cc'ed), we suspected this could be because of clang's aggressive inlining. We also noticed that all the callsites of hrtimer_nanosleep() are tail calls. For a better explanation, I can reach out to the people who are more familiar to clang in the compiler team to see if they have any insights. This may not be of high priority for them though. Hao