From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA914C2D0A8 for ; Sat, 26 Sep 2020 10:52:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A81D1238E5 for ; Sat, 26 Sep 2020 10:52:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726849AbgIZKwl (ORCPT ); Sat, 26 Sep 2020 06:52:41 -0400 Received: from [78.8.192.131] ([78.8.192.131]:22195 "EHLO orcam.me.uk" rhost-flags-FAIL-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1725208AbgIZKwi (ORCPT ); Sat, 26 Sep 2020 06:52:38 -0400 Received: from cvs.linux-mips.org (eddie.linux-mips.org [148.251.95.138]) by orcam.me.uk (Postfix) with ESMTPS id BF1E92BE086; Sat, 26 Sep 2020 11:52:31 +0100 (BST) Date: Sat, 26 Sep 2020 11:52:25 +0100 (BST) From: "Maciej W. Rozycki" To: Damien Le Moal cc: "linux-riscv@lists.infradead.org" , Alistair Francis , "palmerdabbelt@google.com" , Anup Patel , "paul.walmsley@sifive.com" , "aou@eecs.berkeley.edu" , "palmer@dabbelt.com" , "anup@brainfault.org" , Atish Patra , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] RISC-V: Check clint_time_val before use In-Reply-To: <8a99b16ae3037487b762fb1bbcd81b576d9e11ab.camel@wdc.com> Message-ID: References: <20200926072750.807764-1-anup.patel@wdc.com> <1ee25b9bca3956d15a4a0dbf83f43d1ead454220.camel@wdc.com> <0e1990c99bf2a342cd2e78ec7ecfc2fdecaf67fb.camel@wdc.com> <8a99b16ae3037487b762fb1bbcd81b576d9e11ab.camel@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 26 Sep 2020, Damien Le Moal wrote: > > > With this applied in addition to your patch, it works. > > > > > > diff --git a/drivers/clocksource/timer-clint.c b/drivers/clocksource/timer- > > > clint.c > > > index d17367dee02c..8dbec85979fd 100644 > > > --- a/drivers/clocksource/timer-clint.c > > > +++ b/drivers/clocksource/timer-clint.c > > > @@ -37,7 +37,7 @@ static unsigned long clint_timer_freq; > > > static unsigned int clint_timer_irq; > > > > > > #ifdef CONFIG_RISCV_M_MODE > > > -u64 __iomem *clint_time_val; > > > +u64 __iomem *clint_time_val = NULL; > > > #endif > > > > Hmm, BSS initialisation issue? > > Not a static variable, so it is not in BSS, no ? Maybe it has a weird declaration elsewhere which messes up things (I haven't checked), but it looks to me like it does have static storage (rather than automatic or thread one), so if uninitialised it goes to BSS, and it is supposed to be all-zeros whether explicitly assigned a NULL value or not. It does have external rather than internal linkage (as it would if it had the `static' keyword), but it does not matter. Best check with `objdump'/`readelf'. Maciej