Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp57864imj; Fri, 8 Feb 2019 14:56:45 -0800 (PST) X-Google-Smtp-Source: AHgI3IaocW5sziuENWx6RQ1Jjf79NOG7TayT+pM9iSA/hXzQv8eoYzJ0Zq8mkY1RBBHs5/SJxzb2 X-Received: by 2002:a65:51ca:: with SMTP id i10mr22142767pgq.371.1549666605139; Fri, 08 Feb 2019 14:56:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549666605; cv=none; d=google.com; s=arc-20160816; b=n0EB4+8ILyqsuD6rBQlqTTuhFKavWSzVYRYFfsjk7MIaJBSx+En6o4uubcis51ORk9 znNfzDFyO8u2R/gyZXRDQR4CSinTlPb1rJ8alp0RnzgIrsxHxbl5vjdNwi7puvCZ2lA8 keU1fXLX1vtdtyAu3vIRSLUdlmmrSMQlOqDk2lMch6BPSbvWKmx8McWB2x3naVL/JDrR zq6xeYvQeRAk1ThgUSiQUzv/wostFO8gZpVGY04Y//53VZRs4by452/sVxiJNyyi/IZs g5rY2P5IxpUw4vb5dnbSc/M6mgFDVAYcPVDFFH3ptaeP72/mCrRTugFwtWu3hDq+pkRt cQkg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=IeJaZed4g+wLlSXsUgplt3P1eTYtQsW4k3tKPBHq5Lg=; b=m8AOuwg/ue6lcrwNclE8sqy6eTe+5fQOvd4+y/jYk5pBGHgjqNEp93Jn6/6hSesXbg HluQG2bUKovjmpd3yrTYJViTmWsFGAHcaBY2BFkG4MCZeOt2rNVn3552u5kOa3OU8uwr AQqGStiP56UJ+JaUntamkJ+Or45coxZzW+nyl1/RH6AH/PAeVsUo2WCOzX95k+PLSpnH R/w2QTgMgRwMUUcySHG1fXGBCvOURyw4i/zvBFqPx6Qgni6yD4OcqHsD5vIBPoayUbB9 UzizZA3W3FvcWaztvqRngGjL6EpDFXi8Ntl42J+C5NdwSgLajbUzFy3GO8ytwGsh/lW5 jA4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=djk3NTmq; 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=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g187si3197284pgc.26.2019.02.08.14.56.28; Fri, 08 Feb 2019 14:56:45 -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; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=djk3NTmq; 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=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726883AbfBHW4Q (ORCPT + 99 others); Fri, 8 Feb 2019 17:56:16 -0500 Received: from esa3.hgst.iphmx.com ([216.71.153.141]:9486 "EHLO esa3.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726610AbfBHW4P (ORCPT ); Fri, 8 Feb 2019 17:56:15 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1549666575; x=1581202575; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=JJVjRFZ0MjlKPtlNZx40KnljAAcqK9QsHXHfcYZKklo=; b=djk3NTmqlRgA50fxN/cjywDuhjyMM79EQouYR7mrokaiG5RwkF6DqySl nCG47KXU1QjNQbl1dq0CQ8dEIsYDRQeul2k6TTkCZ9ZPXxsTAu0xSFEus ZEU9mVtCFBvpwz5iy9/VVfgevNYwlMp/O1VHVqgaWi4xU5aYRUzODzyH/ jjGweKdwH3gYVv1bdObTB1XnmqdogaCFmX8Scg/Lt+SZ/uTc9JK4GL8FH n4SYrvFGx9vKgW0mwmRDnDgrgbnKp/vX0Mc8vC3E8xfE3nTpMVb7cLndn +eACl8WhfxveGP6ubCifhpATdwt39fc98hniUaf3/nD7Hb/798y27itpT g==; X-IronPort-AV: E=Sophos;i="5.56,564,1539619200"; d="scan'208";a="105811949" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 09 Feb 2019 06:56:15 +0800 Received: from uls-op-cesaip01.wdc.com ([10.248.3.36]) by uls-op-cesaep02.wdc.com with ESMTP; 08 Feb 2019 14:36:56 -0800 Received: from usa003289.ad.shared (HELO [10.86.59.147]) ([10.86.59.147]) by uls-op-cesaip01.wdc.com with ESMTP; 08 Feb 2019 14:56:15 -0800 Subject: Re: [v3 PATCH 6/8] clocksource/drivers/riscv: Add required checks during clock source init To: Christoph Hellwig Cc: Damien Le Moal , Albert Ou , Jason Cooper , Alan Kao , Dmitriy Cherkasov , Anup Patel , Daniel Lezcano , =?UTF-8?Q?Patrick_St=c3=a4hlin?= , "linux-kernel@vger.kernel.org" , Marc Zyngier , Palmer Dabbelt , Paul Walmsley , Andreas Schwab , "linux-riscv@lists.infradead.org" , Thomas Gleixner , Zong Li References: <1549590681-24125-1-git-send-email-atish.patra@wdc.com> <1549590681-24125-7-git-send-email-atish.patra@wdc.com> <20190208090405.GC16932@infradead.org> From: Atish Patra Message-ID: <7e6afb87-73e1-9688-7602-b7579fb94590@wdc.com> Date: Fri, 8 Feb 2019 14:56:13 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190208090405.GC16932@infradead.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/8/19 1:04 AM, Christoph Hellwig wrote: > On Thu, Feb 07, 2019 at 05:51:19PM -0800, Atish Patra wrote: >> Currently, clocksource registration happens for an invalid cpu >> for non-smp kernels. This lead to kernel panic as cpu hotplug >> registration will fail for those cpus. Moreover, >> riscv_hartid_to_cpuid can return errors now. >> >> Do not proceed if hartid or cpuid is invalid. Take this opprtunity >> to print appropriate error strings for different failure cases. >> >> Signed-off-by: Atish Patra >> --- >> drivers/clocksource/timer-riscv.c | 23 ++++++++++++++++++++--- >> 1 file changed, 20 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/clocksource/timer-riscv.c b/drivers/clocksource/timer-riscv.c >> index 43189220..3c7ea75b 100644 >> --- a/drivers/clocksource/timer-riscv.c >> +++ b/drivers/clocksource/timer-riscv.c >> @@ -95,13 +95,30 @@ static int __init riscv_timer_init_dt(struct device_node *n) >> struct clocksource *cs; >> >> hartid = riscv_of_processor_hartid(n); >> + if (hartid < 0) { >> + pr_warn("Not valid hartid for node [%pOF] error = [%d]\n", >> + n, hartid); >> + return hartid; >> + } >> + >> cpuid = riscv_hartid_to_cpuid(hartid); >> + if (cpuid < 0) { >> + pr_warn("Invalid cpuid for hartid [%d]\n", hartid); >> + return cpuid; >> + } >> >> if (cpuid != smp_processor_id()) >> return 0; >> >> + pr_err("%s: Registering clocksource cpuid [%d] hartid [%d]\n", >> + __func__, cpuid, hartid); > > This does not look like an error case to me. At best it is info, > if not debug. > Thanks for catching. It was a typo. I will fix it in next version. Regards, Atish > _______________________________________________ > linux-riscv mailing list > linux-riscv@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-riscv >