Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2336166pxa; Mon, 3 Aug 2020 13:37:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5Qo6lnMNTQwBL2cZqfEzL1zvW2PbGRf6CnKSgh7cu+kz6lRvDE/ZkkO/+cbubzPz7vipa X-Received: by 2002:a17:906:998f:: with SMTP id af15mr17653329ejc.461.1596487058821; Mon, 03 Aug 2020 13:37:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596487058; cv=none; d=google.com; s=arc-20160816; b=X9a6yq3h/Bi4P8xw1WNmQ+opYM94NeiVhiK6Xn8NFWoltShanrwJZk4ahBWio1Vw8G PiY8OObG39zvieRjR9l12Ro394tooL2wUT0QNgrmVsFSqgGjEQZIDd6lTP2zQ1lGUnpM rj2id8F0vgKPoaDjHZjvO2wkmKV3Uxxn++NTkg2Fg/1voLerABfm0fA59JlDx4CkF5aH uBRSHgaO8M6A7K8pwXq4LS26K0opEpN6uYPRtYTuorAbK/YZxI6Z4Lm58P+Wlm1jOCGj 3X8HbeQiO3MLgR7BuOr/jMs5d6fSVM0gIieDS5pjkTcT/AICyuMO398oi9D/V9d7f9WM ulaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:date:to:cc:from :subject:references:in-reply-to:content-transfer-encoding :mime-version:dkim-signature; bh=2F9ZF9htCdgTGnye4Ms9Eo2tsmXq4m2N8BAkR3A5B7A=; b=MoMGA1+vliEFKRRmM6zf1ooBWwqFrvJTrpMFqoOKR8VIygbe7zxX1mvhLwp8ndF9Q6 o5Rejg9BfTjGbMwWgNNbXquEFL7LXSDsLgwTVtDs5ewzhhoxrgSk4DVLWjVLGsbETrb3 a1ULT6Ejle7YPRorrUA5vlMl1Ff545wq2hEL0hAQgYiIaRKT4lbOXmtXuQUfHF97xDM3 emhqHjk4utmmZgBHTZkSQER29VYurTs0ZOnuCLm5afa4rkZxYdrqq0EbGVW2DKxmLfwq jzbBh+VwVYRZFgCSez9HsQZ8zQk3D1PjK2lc45R+2G8bH+5s6MOodM9zt5eKL1UvzyRS d3ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=nZAzQ4lE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si12521361edq.518.2020.08.03.13.37.16; Mon, 03 Aug 2020 13:37:38 -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; dkim=pass header.i=@chromium.org header.s=google header.b=nZAzQ4lE; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728897AbgHCUgJ (ORCPT + 99 others); Mon, 3 Aug 2020 16:36:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728891AbgHCUgI (ORCPT ); Mon, 3 Aug 2020 16:36:08 -0400 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C44EC061756 for ; Mon, 3 Aug 2020 13:36:08 -0700 (PDT) Received: by mail-pl1-x62b.google.com with SMTP id o1so21571516plk.1 for ; Mon, 03 Aug 2020 13:36:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:in-reply-to:references :subject:from:cc:to:date:message-id:user-agent; bh=2F9ZF9htCdgTGnye4Ms9Eo2tsmXq4m2N8BAkR3A5B7A=; b=nZAzQ4lE0whX3zEtFjMirYy1jTai9LIRNYptpFNQIjCWo8AAOs4xmbPjE47De0a5qx 1EsgPv4wgg6wXYETK8ViL/AzUXsH0cNoEImvMSnZiOq02tskOrt+G4T0cyrI4nLxG2b2 CIrG6txBS/AZZTrHr4aFKtBTbweOV0V/mcOSg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding :in-reply-to:references:subject:from:cc:to:date:message-id :user-agent; bh=2F9ZF9htCdgTGnye4Ms9Eo2tsmXq4m2N8BAkR3A5B7A=; b=YIASgel7bJPalqHmcmfbBk1WdZ2Z+j89EWTv6k1wldfa63NeKgWKZGOxkj03OgpzVf TxZvksSgLH2oOWOOYkuWzugaZVW3VP4gzg08WDYPHVPPaJXeRzT/Vm1G7pFcGNH2s4FE EcGrhjTAylRyU6ilUOAWR8XvzzKVesSouoyA7ZIS5ofsfPWemNJ/om9lE4ZBoW7rNKn2 h5ACPRDRO9dWHnlkoWTxmPyIm15KDN06Eij2eXnEOMEz/QDcd+Ot3Ibtb/w3iZW/g0K4 HnaAdvEgTQ9B+xvfSfoXlshur9S6u89FyUr+tzB40OxS9wisr/7Oi+qgk9/p2OcN5wpF J9lg== X-Gm-Message-State: AOAM530YBahDxXJ8UKE/SFAgYqUiDKYx9XDtXOUCWwzzILC1bVD3U2oa NM6FZvib2DQl413+si1mse8v2Q== X-Received: by 2002:a17:90a:4488:: with SMTP id t8mr1023030pjg.191.1596486966811; Mon, 03 Aug 2020 13:36:06 -0700 (PDT) Received: from chromium.org ([2620:15c:202:1:3e52:82ff:fe6c:83ab]) by smtp.gmail.com with ESMTPSA id na16sm336058pjb.30.2020.08.03.13.36.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 13:36:06 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20200729051310.18436-1-saiprakash.ranjan@codeaurora.org> References: <20200729051310.18436-1-saiprakash.ranjan@codeaurora.org> Subject: Re: [PATCHv3] coresight: etm4x: Fix etm4_count race by moving cpuhp callbacks to init From: Stephen Boyd Cc: coresight@lists.linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sai Prakash Ranjan To: Mathieu Poirier , Mike Leach , Sai Prakash Ranjan , Suzuki K Poulose Date: Mon, 03 Aug 2020 13:36:04 -0700 Message-ID: <159648696483.1360974.2828241668912900602@swboyd.mtv.corp.google.com> User-Agent: alot/0.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Sai Prakash Ranjan (2020-07-28 22:13:10) > etm4_count keeps track of number of ETMv4 registered and on some systems, > a race is observed on etm4_count variable which can lead to multiple calls > to cpuhp_setup_state_nocalls_cpuslocked(). This function internally calls > cpuhp_store_callbacks() which prevents multiple registrations of callbacks > for a given state and due to this race, it returns -EBUSY leading to ETM > probe failures like below. >=20 > coresight-etm4x: probe of 7040000.etm failed with error -16 >=20 > This race can easily be triggered with async probe by setting probe type > as PROBE_PREFER_ASYNCHRONOUS and with ETM power management property > "arm,coresight-loses-context-with-cpu". >=20 > Prevent this race by moving cpuhp callbacks to etm driver init since the > cpuhp callbacks doesn't have to depend on the etm4_count and can be once > setup during driver init. Similarly we move cpu_pm notifier registration > to driver init and completely remove etm4_count usage. Also now we can > use non cpuslocked version of cpuhp callbacks with this movement. >=20 > Fixes: 9b6a3f3633a5 ("coresight: etmv4: Fix CPU power management setup in= probe() function") > Fixes: 58eb457be028 ("hwtracing/coresight-etm4x: Convert to hotplug state= machine") > Suggested-by: Suzuki K Poulose > Signed-off-by: Sai Prakash Ranjan > --- Reviewed-by: Stephen Boyd Tested-by: Stephen Boyd