Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1749762pxk; Sat, 26 Sep 2020 03:54:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVSUPGWdHP4+5wNHlTza3+MT0XXKRQqUvlejDb3bYpWeNK3PRmKF9p2Zbu+uVh7qoEoKmA X-Received: by 2002:a17:906:d9da:: with SMTP id qk26mr6763610ejb.435.1601117672969; Sat, 26 Sep 2020 03:54:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601117672; cv=none; d=google.com; s=arc-20160816; b=GZPkaIPxMUVWAwSBABYXxRYmTY+Yb/9SzCSAKsw3n4ejpdyHwRmjMkgOH76XpfjKqx rWLtw+mqXf7NeT4/m3n2Qf42l8ERY+WnCDD1FJEsQvt6IsAIHbX/ArALvI+fwBpZx9yV E17xZPQau1VFR6VLTotQe+VaDKlgSf2hMgWQClZiEyHxCAb03fxQvAhM8I/aT/PhDGLE kUDDQs+iMaoZurdT2MLf30XXcF1gMbHXphQZkcBMXeo7lrANAY5YWJo9f9GTr30ECLl6 JWgOUNEy/6nMDbho6msSF8OBwtGuG0+y6xKF2nVhVbmm7LT0upqg0tdB588m6v8VJKeb 3zXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date; bh=R0e7uH3k0Ddj1MjOkHRbalohjuDodoL9z3EQ/Wfs6ro=; b=bVwOF7SGkTr0gO2IBJ5+MlZvgTx8JFTH8uXn7+bUp3davqrd7Aq6VS41CyWn00TXUc jceve9n1DlRGApcY2MPcKGVVIDhnoh4vdiJagX6lLlzr5+5mt9vBy7id2PyR8ahyoCjg MAcZNDMeUWLDKGl3iMshjM+55buLhxuDuHiOxf/cZbhwJPjgIbk41/BYM6SYMPNTocwi aAwrbBc3r79j/ewn3Vgf/NALVEbAp2rjLKCI0fuzGNxjKy9+NJE17fV4Ojq0NnKCR/c7 yhZNx4cE0m8RHUzZwneA6JZWxKBmFUmFLpI6FxHB67hCjBXI+Yrty3Hh86nJ5tPNPUZD 9jIA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 19si3499599ejb.381.2020.09.26.03.54.09; Sat, 26 Sep 2020 03:54:32 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726412AbgIZKwk (ORCPT + 99 others); Sat, 26 Sep 2020 06:52:40 -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