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=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=unavailable 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 EFEA1C433DF for ; Thu, 13 Aug 2020 15:12:39 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B2AB720791 for ; Thu, 13 Aug 2020 15:12:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="h8cvHaPb" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B2AB720791 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8Te1FbORzN0Ua5GEYzahahye2A9hIb47ztkatffzIQs=; b=h8cvHaPbHxfNzEhLfm4iOG9cX JEP48CGOtUkrKb49FISkHhAvx2cuvlsYHfAxg9o+rWh57Y8yBzyEkCiO+peX8D3jKCz7lpNlbB7qd YzMXufFUzsT1+LjsDb1iFBAgtLmoTMrmaTnHM55VuKQELx2Uchz6A4C3RrKJ0wSghCpgZwMkrECjG zTPhzn7KemtRSA1stcNz2vd93aZy5tIJoOpkOyEGMRt63gvnKG4++unWRRXcouhsbvYgTjUZDR5gf AL4Lf19/Ik4h6AjlB0btD/s7656Pa0s9hFjpy4GRhPVidbiuVE37EOqRA8NB3ws6qAEv+Rc9UFkf6 lFGIXTumQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6EsE-0006rZ-AK; Thu, 13 Aug 2020 15:10:34 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k6EsA-0006qw-N6 for linux-arm-kernel@lists.infradead.org; Thu, 13 Aug 2020 15:10:31 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3685631B; Thu, 13 Aug 2020 08:10:27 -0700 (PDT) Received: from [192.168.122.166] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9AADE3F6CF; Thu, 13 Aug 2020 08:10:26 -0700 (PDT) Subject: Re: [PATCH] coresight: fix offset by one error in counting ports To: Mian Yousaf Kaukab , linux-arm-kernel@lists.infradead.org, mathieu.poirier@linaro.org, suzuki.poulose@arm.com References: <20200813100456.11803-1-ykaukab@suse.de> From: Jeremy Linton Message-ID: <444a23b2-70d6-6be7-48e9-61f36dd203ee@arm.com> Date: Thu, 13 Aug 2020 10:10:19 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <20200813100456.11803-1-ykaukab@suse.de> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200813_111030_870545_6D1B6A0B X-CRM114-Status: GOOD ( 28.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexander.shishkin@linux.intel.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, tingwei@codeaurora.org, Ruediger Oertel , mike.leach@linaro.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, As Suzuki mentioned, I hit this on the N1SDP, and as of yesterday afternoon was running a patch that is identical to what you posted here. This fixes the boot failure and WARN_ON's I was seeing, and appears to return the N1SDP to basic functionality. I think there is at least one further issue, but its unrelated to this. So, Tested-by: Jeremy Linton also, might as well: Reviewed-by: Jeremy Linton On 8/13/20 5:04 AM, Mian Yousaf Kaukab wrote: > Since port-numbers start from 0, add 1 to port-number to get the port > count. > > Fix following crash when Coresight is enabled on ACPI based systems: > > [ 61.061736] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000008 > ... > [ 61.135494] pc : acpi_coresight_parse_graph+0x1c4/0x37c > [ 61.140705] lr : acpi_coresight_parse_graph+0x160/0x37c > [ 61.145915] sp : ffff800012f4ba40 > [ 61.145917] x29: ffff800012f4ba40 x28: ffff00becce62f98 > [ 61.159896] x27: 0000000000000005 x26: ffff00becd8a7c88 > [ 61.165195] x25: ffff00becd8a7d88 x24: ffff00becce62f80 > [ 61.170492] x23: ffff800011ef99c0 x22: ffff009efb8bc010 > [ 61.175790] x21: 0000000000000018 x20: 0000000000000005 > [ 61.181087] x19: ffff00becce62e80 x18: 0000000000000020 > [ 61.186385] x17: 0000000000000001 x16: 00000000000002a8 > [ 61.191682] x15: ffff000838648550 x14: ffffffffffffffff > [ 61.196980] x13: 0000000000000000 x12: ffff00becce62d87 > [ 61.202277] x11: 00000000ffffff76 x10: 000000000000002e > [ 61.207575] x9 : ffff8000107e1a68 x8 : ffff00becce63000 > [ 61.212873] x7 : 0000000000000018 x6 : 000000000000003f > [ 61.218170] x5 : 0000000000000000 x4 : 0000000000000000 > [ 61.223467] x3 : 0000000000000000 x2 : 0000000000000000 > [ 61.228764] x1 : ffff00becce62f80 x0 : 0000000000000000 > [ 61.234062] Call trace: > [ 61.236497] acpi_coresight_parse_graph+0x1c4/0x37c > [ 61.241361] coresight_get_platform_data+0xdc/0x130 > [ 61.246225] tmc_probe+0x138/0x2dc > [ 61.246227] amba_probe+0xdc/0x220 > [ 61.255779] really_probe+0xe8/0x49c > [ 61.255781] driver_probe_device+0xec/0x140 > [ 61.255782] device_driver_attach+0xc8/0xd0 > [ 61.255785] __driver_attach+0xac/0x180 > [ 61.265857] bus_for_each_dev+0x78/0xcc > [ 61.265859] driver_attach+0x2c/0x40 > [ 61.265861] bus_add_driver+0x150/0x244 > [ 61.265863] driver_register+0x80/0x13c > [ 61.273591] amba_driver_register+0x60/0x70 > [ 61.273594] tmc_driver_init+0x20/0x2c > [ 61.281582] do_one_initcall+0x50/0x230 > [ 61.281585] do_initcalls+0x104/0x144 > [ 61.291831] kernel_init_freeable+0x168/0x1dc > [ 61.291834] kernel_init+0x1c/0x120 > [ 61.299215] ret_from_fork+0x10/0x18 > [ 61.299219] Code: b9400022 f9400660 9b277c42 8b020000 (f9400404) > [ 61.307381] ---[ end trace 63c6c3d7ec6a9b7c ]--- > [ 61.315225] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b > > Fixes: d375b356e687 ("coresight: Fix support for sparsely populated ports") > Reported-by: Ruediger Oertel > Signed-off-by: Mian Yousaf Kaukab > --- > drivers/hwtracing/coresight/coresight-platform.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c > index bfd44231d7ad..227e234a2470 100644 > --- a/drivers/hwtracing/coresight/coresight-platform.c > +++ b/drivers/hwtracing/coresight/coresight-platform.c > @@ -711,11 +711,11 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, > return dir; > > if (dir == ACPI_CORESIGHT_LINK_MASTER) { > - if (ptr->outport > pdata->nr_outport) > - pdata->nr_outport = ptr->outport; > + if (ptr->outport >= pdata->nr_outport) > + pdata->nr_outport = ptr->outport + 1; > ptr++; > } else { > - WARN_ON(pdata->nr_inport == ptr->child_port); > + WARN_ON(pdata->nr_inport == ptr->child_port + 1); > /* > * We do not track input port connections for a device. > * However we need the highest port number described, > @@ -723,8 +723,8 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev, > * record for an output connection. Hence, do not move > * the ptr for input connections > */ > - if (ptr->child_port > pdata->nr_inport) > - pdata->nr_inport = ptr->child_port; > + if (ptr->child_port >= pdata->nr_inport) > + pdata->nr_inport = ptr->child_port + 1; > } > } > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel