Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3189876imu; Mon, 17 Dec 2018 15:09:26 -0800 (PST) X-Google-Smtp-Source: AFSGD/UD/1Y200PUFp6oSCOlNQh5b1cSko5NSS5Iy1PNCQdMS0ziWfTH2v/LdvNLYH0bZBqu80oo X-Received: by 2002:a63:da45:: with SMTP id l5mr13889993pgj.111.1545088166700; Mon, 17 Dec 2018 15:09:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545088166; cv=none; d=google.com; s=arc-20160816; b=A1JIqnIx2eAVtlZpvWVpGrsMSdCjWpkgu3zh2JydO+0tbwV96LYcsX6sFSFDqCFh2d +VI6iEj0pQoCA4O6c7jGi8DkSL4JsuzCYkJX6QWl479uVX3e5cTR2QKg7r4rSLgNLpVo UMWD2LSE0UfQrIQ0t3VBRR+r2XpdzChY2kIQk/gWUcICUgzFu/PhFIDj3tKwntbCylDL 763OTYb0B9fzHM5K++sAxBKeADUUNk9Ux4aX6lOYOBouNJ21JvGHp2uFvgIByb5BMbN6 WqnXwhKk7vEWqNXGQwX+tkvStWvgXWa3UHU2V9zhMa31qHzIC6y09SLC+3aU1W2dZR/n ybeA== 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=DoalR7KS8clQNqOMH0zgwzMznRzV3QicvHqTfGVmhW8=; b=joN1+tFnaEdmldgfhVWMuOK5rizxae1oIdBlNOPxvrqtLEdnUxV1KMQ+icoorD69mk Bg1pY/aA5ArYkVATeuDOQST8CMlQMmUCATrQjl8o3qFRLron7JBpNgarNrhnaHrBynSF YeYKnZTCtjaWX75iEZbE2g41c+iGV9n8iOl4N/QchNFrQICfv1EdgfIIim0Z1mzjEUd1 5grXaWcJX8MgT1N1c1w2IbENgGhiCImwlz0tAKdmqv3le/HC7bOkS8pCB5Zsml06d8RQ AjTXpMsxDl3io+oDcdoAHOjW3pWkc2e6XoCzn1gg8NysAi76mYGCTKTMgDk+vb71jmkR 0fVA== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ca6si5015069plb.141.2018.12.17.15.09.11; Mon, 17 Dec 2018 15:09:26 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388659AbeLQSQn (ORCPT + 99 others); Mon, 17 Dec 2018 13:16:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:36694 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727597AbeLQSQm (ORCPT ); Mon, 17 Dec 2018 13:16:42 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A592665856; Mon, 17 Dec 2018 18:16:41 +0000 (UTC) Received: from treble (ovpn-120-179.rdu2.redhat.com [10.10.120.179]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E100608F2; Mon, 17 Dec 2018 18:16:40 +0000 (UTC) Date: Mon, 17 Dec 2018 12:16:38 -0600 From: Josh Poimboeuf To: Andi Kleen Cc: Arnd Bergmann , Peter Zijlstra , Linux Kernel Mailing List , the arch/x86 maintainers , Steven Rostedt , Miroslav Benes Subject: Re: objtool warnings for kernel/trace/trace_selftest_dynamic.o Message-ID: <20181217181638.dfexg6mkmbfyzfli@treble> References: <20181217173900.ygifx7khwmzn2gv2@treble> <20181217180434.GS25620@tassilo.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181217180434.GS25620@tassilo.jf.intel.com> User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 17 Dec 2018 18:16:41 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 17, 2018 at 10:04:34AM -0800, Andi Kleen wrote: > On Mon, Dec 17, 2018 at 11:39:00AM -0600, Josh Poimboeuf wrote: > > On Sun, Dec 16, 2018 at 07:33:11PM +0100, Arnd Bergmann wrote: > > > Hi Josh, > > > > > > In randconfig tests with gcc-8.1, I get this warning every > > > few hundred builds, tried it on both next/master and 4.19.y-stable: > > > > > > kernel/trace/trace_selftest_dynamic.o: warning: objtool: > > > trace_selftest_dynamic_test_func()+0x5: call without frame pointer > > > save/setup > > > kernel/trace/trace_selftest_dynamic.o: warning: objtool: > > > trace_selftest_dynamic_test_func2()+0x5: call without frame pointer > > > save/setup > > > > > > $ objdump -dr build/x86/0x90C84554_defconfig/kernel/trace/trace_selftest_dynamic.o > > > > > > build/x86/0x90C84554_defconfig/kernel/trace/trace_selftest_dynamic.o: > > > file format elf64-x86-64 > > > > > > Disassembly of section .text: > > > > > > 0000000000000000 : > > > 0: e8 00 00 00 00 callq 5 > > > > > > 1: R_X86_64_PC32 __fentry__-0x4 > > > 5: e8 00 00 00 00 callq a > > > > > > 6: R_X86_64_PC32 __sanitizer_cov_trace_pc-0x4 > > > a: 31 c0 xor %eax,%eax > > > c: c3 retq > > > d: 0f 1f 00 nopl (%rax) > > > > > > 0000000000000010 : > > > 10: e8 00 00 00 00 callq 15 > > > > > > 11: R_X86_64_PC32 __fentry__-0x4 > > > 15: e8 00 00 00 00 callq 1a > > > > > > 16: R_X86_64_PC32 __sanitizer_cov_trace_pc-0x4 > > > 1a: 31 c0 xor %eax,%eax > > > 1c: c3 retq > > > > > > I found this reported in > > > http://kisskb.ellerman.id.au/kisskb/buildresult/13499139/, but could > > > not find an existing fix or analysis. > > > > Thanks for reporting this Arnd. > > > > The problem is that, for some reason, __noclone is preventing GCC from > > creating frame pointers for these functions. Miroslav said that > > That seems weird. > > Are you sure it's not just because they are empty? AFAIK > gcc doesn't necessarily generate frame pointers for empty functions. I suspected that it was because they're empty, however I didn't see this warning for other leaf functions. The sancov plugin is presumably taking care of adding frame pointers where needed. Also, adding -mno-omit-leaf-frame-pointer didn't fix it. And anyway I confirmed that it was fixed by removing __noclone. > > __noclone is not recommended by GCC developers, and that __used can be > > used instead for the same purpose: > > > > https://lkml.kernel.org/r/alpine.LSU.2.21.1812171256390.3087@pobox.suse.cz > > > > Andi, > > > > is __noclone really needed here, since the functions aren't static? Or > > does LTO cause them to be treated like static functions? > > Yes LTO causes the to be treated like static functions. > > I guess noclone is unlikely to be really needed here because these > functions are unlikely to be cloned. > > So as a workaround it could be removed. > > But note we have other noclone functions in the tree (like in KVM) > which actually need it. How about we just use the __used attribute then? It seems to have the same result of preventing IPA optimizations (without the weird side effect of missing frame pointers). -- Josh