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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 B0533C43613 for ; Thu, 20 Jun 2019 13:55:30 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 86CD020675 for ; Thu, 20 Jun 2019 13:55:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kIRaZnx5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 86CD020675 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+infradead-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=bombadil.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=gkJvWIZVYFgL4axxH7vPkF6O+S6kFL9NhWvJ4cFtenQ=; b=kIRaZnx5GQdpOuz0W5O2CEtzT fZPGsS0yDyyCwSj515mVYkMqSWAxo7AjLBLZw1WylzHY2bCOI2venv1uo/FzystufBuAEsgoliqSt 5wzhFppXAzCJ6DTnwExD0ISm7trPpwiWxN5RuQNKf9V3ZQA/K6jPJKJCqfhaBJB41rO6R0wcVPmV5 oSQTr9SzuOrelbkB0nO3Ux4wqJQe4M/L0dKnYSOaycyEHYYE5G/pZvVcFXpzjjC8wcgL0OdDIqQcc jIWSLQ6IvChV0jJTU/Denu/OyZDA8/Nv7VsfzM3fdIiS+4IkoTMCg0Qhy9ICCEZxywtbYD3anKHoc cCrhE8MDA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdxXD-0007lC-RX; Thu, 20 Jun 2019 13:55:27 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdxXA-0007kr-LG for linux-arm-kernel@lists.infradead.org; Thu, 20 Jun 2019 13:55:25 +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 E2D90344; Thu, 20 Jun 2019 06:55:22 -0700 (PDT) Received: from [10.1.196.93] (en101.cambridge.arm.com [10.1.196.93]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 55DE23F718; Thu, 20 Jun 2019 06:55:21 -0700 (PDT) Subject: Re: [PATCH 1/2] coresight: Set affinity to invalid for missing CPU phandle To: saiprakash.ranjan@codeaurora.org, mathieu.poirier@linaro.org, leo.yan@linaro.org, alexander.shishkin@linux.intel.com, andy.gross@linaro.org, david.brown@linaro.org, mark.rutland@arm.com References: <49d6554536047b9f5526c4ea33990b7c904673d3.1561037262.git.saiprakash.ranjan@codeaurora.org> From: Suzuki K Poulose Message-ID: Date: Thu, 20 Jun 2019 14:55:20 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <49d6554536047b9f5526c4ea33990b7c904673d3.1561037262.git.saiprakash.ranjan@codeaurora.org> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190620_065524_745485_C6232049 X-CRM114-Status: GOOD ( 22.98 ) 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: rnayak@codeaurora.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, sibis@codeaurora.org, vivek.gautam@codeaurora.org, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org Sai, Thanks for the patch. Please could you change the subject to : "coresight: Do not default to CPU0 for missing CPU phandle" On 20/06/2019 14:45, Sai Prakash Ranjan wrote: > Affinity defaults to CPU0 in case of missing CPU phandle > and this leads to crashes in some cases because of such > wrong assumption. Fix this by returning -ENODEV in Thats not the right justification. Causing crashes is due to bad DT/firmware. I would be happy with something like : "Coresight platform support assumes that a missing \"cpu\" phandle defaults to CPU0. This could be problematic and unnecessarily binds components to CPU0, where they may not be. Let us make the DT binding rules a bit stricter by not defaulting to CPU0 for missing "cpu" affinity information." Also, you must 1) update the devicetree/bindings document to reflect the same. 2) update the drivers to take appropriate action on the missing CPU where they are expected (e.g, CPU-debug, etm*), to prevent breaking a bisect. > coresight platform for such cases and then handle it > in the coresight drivers. > > Signed-off-by: Sai Prakash Ranjan > --- > drivers/hwtracing/coresight/coresight-platform.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c > index 3c5ceda8db24..b1ea60c210e1 100644 > --- a/drivers/hwtracing/coresight/coresight-platform.c > +++ b/drivers/hwtracing/coresight/coresight-platform.c > @@ -160,15 +160,17 @@ static int of_coresight_get_cpu(struct device *dev) > > if (!dev->of_node) > return 0; > + > dn = of_parse_phandle(dev->of_node, "cpu", 0); > - /* Affinity defaults to CPU0 */ > + > + /* Affinity defaults to invalid if no cpu nodes are found*/ The code is self explanatory here. You could drop the comment. > if (!dn) > - return 0; > + return -ENODEV; > + > cpu = of_cpu_node_to_id(dn); > of_node_put(dn); > > - /* Affinity to CPU0 if no cpu nodes are found */ > - return (cpu < 0) ? 0 : cpu; > + return cpu; > } > Suzuki _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel