Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1391596ybt; Sat, 27 Jun 2020 07:01:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQRdJZlqBk6SC+uThS1zkrnwYwAbeC5QDZMlsM6dUEnUkOn6fulqATxxuadUwqt47USBGn X-Received: by 2002:a50:fc97:: with SMTP id f23mr259267edq.255.1593266470352; Sat, 27 Jun 2020 07:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593266470; cv=none; d=google.com; s=arc-20160816; b=zigT1mdFvyZrQ5i36JJCkvQyZ8ghjp79AvjdqdA63bjLnc11UXw5fI5IUA+aM7vz+o dISANwKX1IPX34wRGb89vZ6V7rcfkzuLwVVsgBavd1Kuj+9VpXh/ihbiQaC05Fliy/3F 0gYf70EPG2/LE6GgeXyw64Wco1l4SqjnEE1U6M+oyDYWVcaJYOqh234ytmaoVFseSKQX 0OWjblMKHL6rsXQU2WJFx6rEiIzr5/hUhJOHZH3U1zJKsDvUdfym6Uks1/jSCcvPCc2N 6SFRl9rs5lfLW8NiP6kafIQWQ6yrpVvn67e50noAWfcyFVrfD7hIK9cySyPMSA7ecMTy BwBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=gFnQUzEg/EKhudIqBk3k0UHJr9+ENrGukIzutgUnv3o=; b=o7lb318lKzs/5AQMCeObbiB1z9S+Z23AbUWMeD+1qWsCTvMQCn6Hzbf3LEDcMnB/2k 5HeRYM+cXxClk2mlyDb/0PUdw3odsVB7tdpaeKLsrzTulLMnykyKzc1NWO7xjPshu8p2 7G1x+5EJBCm0loOcNLhvpmLWhkzzifPHMoD/+EGieqi1uau5ZD4npNiHY7RWN68SWfqa KUHXCYKRtrNhixtHHuVooGF5WW5CZ0/B5NfuqNR3D7Bu9+/2CR9RFJoapLcDSiZAdwW8 UZBu1JeEhvJL4gjCWBPvOgEoSBM0XSNwlCSGri7Q9vXhe1ildlGb5UxpRf4Y+kkYefoC bhfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lm8M5nIo; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f5si3088288edt.71.2020.06.27.07.00.47; Sat, 27 Jun 2020 07:01:10 -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=@kernel.org header.s=default header.b=lm8M5nIo; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726721AbgF0N6U (ORCPT + 99 others); Sat, 27 Jun 2020 09:58:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:57608 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725850AbgF0N6T (ORCPT ); Sat, 27 Jun 2020 09:58:19 -0400 Received: from localhost.localdomain (unknown [89.208.247.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E0E6F2168B; Sat, 27 Jun 2020 13:58:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593266298; bh=oewV1O6rTie7xVw3ZbfoIwUSB6OBIDTPoEv9gkp7Umk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lm8M5nIoA+Om5IGeuhZgFH1YBi9xT8SLoDQSKMHbECN1QHQpiWs8i4DvbAb2wTdPz mMzKzb+6l/96eWtrIj9e7E4PWPO1rQdLOfhflVc/vdaf8c3urHzTCrE/Or95/eDUm7 ZObVHpHT7PaqV6gcjGkl7rMH5ax+1a3riNaZrzeU= From: guoren@kernel.org To: palmerdabbelt@google.com, paul.walmsley@sifive.com, anup@brainfault.org, greentime.hu@sifive.com, zong.li@sifive.com, aou@eecs.berkeley.edu, tglx@linutronix.de, tycho@tycho.ws, nickhu@andestech.com Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, Guo Ren Subject: [PATCH V2 1/3] riscv: Fixup static_obj() fail Date: Sat, 27 Jun 2020 13:57:06 +0000 Message-Id: <1593266228-61125-2-git-send-email-guoren@kernel.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1593266228-61125-1-git-send-email-guoren@kernel.org> References: <1593266228-61125-1-git-send-email-guoren@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Guo Ren When enable LOCKDEP, static_obj() will cause error. Because some __initdata static variables is before _stext: static int static_obj(const void *obj) { unsigned long start = (unsigned long) &_stext, end = (unsigned long) &_end, addr = (unsigned long) obj; /* * static variable? */ if ((addr >= start) && (addr < end)) return 1; [ 0.067192] INFO: trying to register non-static key. [ 0.067325] the code is fine but needs lockdep annotation. [ 0.067449] turning off the locking correctness validator. [ 0.067718] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.7.0-rc7-dirty #44 [ 0.067945] Call Trace: [ 0.068369] [] walk_stackframe+0x0/0xa4 [ 0.068506] [] show_stack+0x2a/0x34 [ 0.068631] [] dump_stack+0x94/0xca [ 0.068757] [] register_lock_class+0x5b8/0x5bc [ 0.068969] [] __lock_acquire+0x6c/0x1d5c [ 0.069101] [] lock_acquire+0xae/0x312 [ 0.069228] [] _raw_spin_lock_irqsave+0x40/0x5a [ 0.069357] [] complete+0x1e/0x50 [ 0.069479] [] rest_init+0x1b0/0x28a [ 0.069660] [] 0xffffffe0000016a2 [ 0.069779] [] 0xffffffe000001b84 [ 0.069953] [] 0xffffffe000001092 static __initdata DECLARE_COMPLETION(kthreadd_done); noinline void __ref rest_init(void) { ... complete(&kthreadd_done); Signed-off-by: Guo Ren --- arch/riscv/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/kernel/vmlinux.lds.S b/arch/riscv/kernel/vmlinux.lds.S index e6f8016..f3586e3 100644 --- a/arch/riscv/kernel/vmlinux.lds.S +++ b/arch/riscv/kernel/vmlinux.lds.S @@ -22,6 +22,7 @@ SECTIONS /* Beginning of code and text segment */ . = LOAD_OFFSET; _start = .; + _stext = .; HEAD_TEXT_SECTION . = ALIGN(PAGE_SIZE); @@ -54,7 +55,6 @@ SECTIONS . = ALIGN(SECTION_ALIGN); .text : { _text = .; - _stext = .; TEXT_TEXT SCHED_TEXT CPUIDLE_TEXT -- 2.7.4