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=-7.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=no 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 B0D57C433F8 for ; Mon, 27 Jul 2020 14:14:19 +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 737772078E for ; Mon, 27 Jul 2020 14:14:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QsFp1yfr"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="iThiLIH+" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 737772078E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org 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:Message-ID:References:In-Reply-To:Subject:To:From: Date:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=8ExOfK4pqPv2GxtXjO0PhBo30W1v2zEfw89z0207xY8=; b=QsFp1yfrsJg9uRk/6paQgMpIH jdAyWVgRGWT8lzWvDg+CR08NRFuVn5kMyBhzvr97hQZbuDTKosYvfw/7jVN2phx3B0VMdF54sqARK Xxi2dULKXlfozeuR0Ipazb2tMxutKrIqJltcgsUV4GLvmk2MmYR9uae2c1G2KtY5U0ETlQneY6QN9 j0A5V0Yp1f+rD080xDNEmJF014u1Xjv5AuUzadKhtVvn6eElQsZRNQhI8wu4Hty6qhR0EJoA1qLUi vuIAar3hhS6Ow1IKUvRw1Pytq3SiYiA3NTzb9A/84Xx0EperaX33digWnw862fVfECAMGOHw2iuWr CUKwNjavQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k03s2-0006DI-Ng; Mon, 27 Jul 2020 14:12:50 +0000 Received: from mail29.static.mailgun.info ([104.130.122.29]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k03s0-0006CC-EZ for linux-arm-kernel@lists.infradead.org; Mon, 27 Jul 2020 14:12:49 +0000 DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1595859167; h=Message-ID: References: In-Reply-To: Subject: Cc: To: From: Date: Content-Transfer-Encoding: Content-Type: MIME-Version: Sender; bh=od6qu1NhBeEXZbA2Vs3vSoZKYr7uCAz7VQWNJzNyddA=; b=iThiLIH+P134K6SWQL0cRvLKCTt17EnWswMY7I+pOAJzp8pkpXEGwqBX0kFjXGeq58ekayVh yamCkXnWJ+P7Hiz9DHg6q3kicVgWDjRCEoUQuyC/nvml7Imvg2dM5mHsx96sTXAlcvDP0jHi TZRWff27nhNmwpphkR1HvqD3ZIA= X-Mailgun-Sending-Ip: 104.130.122.29 X-Mailgun-Sid: WyJiYzAxZiIsICJsaW51eC1hcm0ta2VybmVsQGxpc3RzLmluZnJhZGVhZC5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by smtp-out-n04.prod.us-east-1.postgun.com with SMTP id 5f1ee0d8fcbecb3df15abbe5 (version=TLS1.2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256); Mon, 27 Jul 2020 14:12:40 GMT Received: by smtp.codeaurora.org (Postfix, from userid 1001) id 7AB75C433CA; Mon, 27 Jul 2020 14:12:39 +0000 (UTC) Received: from mail.codeaurora.org (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: saiprakash.ranjan) by smtp.codeaurora.org (Postfix) with ESMTPSA id 02493C4344C; Mon, 27 Jul 2020 14:12:37 +0000 (UTC) MIME-Version: 1.0 Date: Mon, 27 Jul 2020 19:42:37 +0530 From: Sai Prakash Ranjan To: Suzuki K Poulose Subject: Re: [PATCH] coresight: etm4x: Fix etm4_count race using atomic variable In-Reply-To: References: <20200727060728.15027-1-saiprakash.ranjan@codeaurora.org> Message-ID: <7a98dc32652731e7a795e150e7e8d14f@codeaurora.org> X-Sender: saiprakash.ranjan@codeaurora.org User-Agent: Roundcube Webmail/1.3.9 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200727_101248_552706_382E8D19 X-CRM114-Status: GOOD ( 17.22 ) 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: mathieu.poirier@linaro.org, linux-arm-msm@vger.kernel.org, coresight@lists.linaro.org, linux-kernel@vger.kernel.org, swboyd@chromium.org, linux-arm-kernel@lists.infradead.org, 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 On 2020-07-27 15:09, Suzuki K Poulose wrote: > On 07/27/2020 07:07 AM, Sai Prakash Ranjan wrote: >> 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. >> >> coresight-etm4x: probe of 7040000.etm failed with error -16 >> >> 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". >> >> Prevent this race by converting etm4_count variable to atomic. >> >> Fixes: 9b6a3f3633a5 ("coresight: etmv4: Fix CPU power management setup >> in probe() function") >> Fixes: 58eb457be028 ("hwtracing/coresight-etm4x: Convert to hotplug >> state machine") >> Suggested-by: Mike Leach >> (Mike: Rootcause and context for commit message) >> Signed-off-by: Sai Prakash Ranjan > > Please could we leave the hotplug notifier installed with the driver > init and don't worry about this at all ? We bail out early in the > notifier anyways, if the CPU is not registered with its ETM. > Sure thing, sorry for not taking the cue from earlier discussion. Thanks, Sai -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel