Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1162548ybz; Wed, 22 Apr 2020 14:56:50 -0700 (PDT) X-Google-Smtp-Source: APiQypLLi08jD1yyfQNY8Y8IJTqAyOzHxdClh8mu7vq2JFwlN5Vn95ONvdAnpnnFd8lG2Ml+qNZO X-Received: by 2002:a17:906:2296:: with SMTP id p22mr321267eja.269.1587592610748; Wed, 22 Apr 2020 14:56:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587592610; cv=none; d=google.com; s=arc-20160816; b=ZIwMOqM806I0g2f2Y/RjvQFYTESzXeS82NCkUd6/0JjUluKpBbxHeKmEok3do2+031 hu6CoU6E4vValik7YdCW8LRkUQ7aHxO7qAOl3X5RBB2oikrIHUgCP5vCRy9xm0ZJ1R9P 2U/fAcl7VArFRkPprqOv1Emc88OezREbX1JO8zbn6aeU8ayhyma/Vyg8S4DZoHUej3T9 MVWl8bO4qNy2hNOUxQVKZkp5x3pokFtTs/zGQcodDAw8W5Gq0l+0I6mg/eRnpdTm20av iW+LfGzVVfGWI5HdGvufI4ZCCTBhIbtdmcayGf0u6uZ/619rqcrBiLJnYwSb/gEHEKfF 6vwQ== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HfuhF99BRaSEh0bfmWqr7aSzcTnP1RLVseb4QVvFXi8=; b=LdxNRq8WzY/jS1wccJjLNwRlDpgTLxnJZv9nup0xVcdDG/IHXYDseqV78l5L0ohBea L66s3kGzt0F6Z6trwLPX7NRQ8tZHqDMb033L11Z+vUOnwTk5qBXYxb1ta04Sq8LiiCNK FkCqY95UuGZPmyMF3AfRMtLPzSIxCgDksLqH2kYrHcIUXvH3Fdr2xCY8vdOcjHd5cfKt YmnNKYTyDviRB9CVMCPALlUG8nj9uLt8RERgIgqKIrf+CLmmIJ06lKfxIwwP5Zb5NBMO yCuSaV+O9gFz20fBVgyJibbW5j7EPiGEp9h7JiAT7A7eSJ5wq5lmlyoIvvagnRh6HGRv jODg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lMzLpPm6; 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 by26si227219edb.144.2020.04.22.14.56.26; Wed, 22 Apr 2020 14:56:50 -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=lMzLpPm6; 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 S1726353AbgDVVz2 (ORCPT + 99 others); Wed, 22 Apr 2020 17:55:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726109AbgDVVz0 (ORCPT ); Wed, 22 Apr 2020 17:55:26 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43195C03C1A9 for ; Wed, 22 Apr 2020 14:55:26 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id r14so1829971pfg.2 for ; Wed, 22 Apr 2020 14:55:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HfuhF99BRaSEh0bfmWqr7aSzcTnP1RLVseb4QVvFXi8=; b=lMzLpPm6h+VTQ1aXb2wCKeBILA8eBpvnCjaMmppBWioTLLm56Fars7TegBE981Y4qa UOdGk+wGv/kTK/aZzPeroP9IgG2TaeCkUoP1xJdMwgQA8t3RJcynzQndzKK/IT/4kFLc GPomLauJym/7f+mCx5tyPC+qCW8zVmC1mK/kg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HfuhF99BRaSEh0bfmWqr7aSzcTnP1RLVseb4QVvFXi8=; b=Fbi9yNiFSMajr5HOFIThNI8eRvGbaGv3jpLXMamrsrSJh/LsiAhIY837LIhWQhC+UM wd4ue58CYFWSN9aUsfXqSRdub2HPfHkD0v3JETBvR8AfYvAbqQZwysbXNBY1yAp76aYE 5/RjPKJo/WOEDEaWyCXTxqhK1nOXs0c/woFdoqhTjH5/lOiDQY1MqVc2p1rO9Eb12xSl 1/KuyJLeSLO5f2FBxrz6hqzYTENkgBDC2nZ+6/bb0rpE0she5kAzx9E7dn8RfBr3CRSd I1zYXYJ/nzonIcbCalK8qTUbIWygkaKxK46Woj5XhkXz7iftEw1Husjs8xzVYkPnws+6 cdOQ== X-Gm-Message-State: AGi0PubbyyV/6KnbrIM+jeEuzSeGTRzzPVC3ZMlMOZQLBSXg4mROYPE4 Mjev48RGzmtUn6IdxO/G/CjLRg== X-Received: by 2002:a63:df42:: with SMTP id h2mr1118598pgj.216.1587592525841; Wed, 22 Apr 2020 14:55:25 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id r4sm211072pgi.6.2020.04.22.14.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Apr 2020 14:55:25 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , rafael.j.wysocki@intel.com, Andy Gross , Bjorn Andersson Cc: mka@chromium.org, swboyd@chromium.org, mkshah@codeaurora.org, evgreen@chromium.org, Douglas Anderson , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/5] soc: qcom: rpmh-rsc: We aren't notified of our own failure w/ NOTIFY_BAD Date: Wed, 22 Apr 2020 14:55:00 -0700 Message-Id: <20200422145408.v4.2.I1927d1bca2569a27b2d04986baf285027f0818a2@changeid> X-Mailer: git-send-email 2.26.1.301.g55bc3eb7cb9-goog In-Reply-To: <20200422145408.v4.1.Ic7096b3b9b7828cdd41cd5469a6dee5eb6abf549@changeid> References: <20200422145408.v4.1.Ic7096b3b9b7828cdd41cd5469a6dee5eb6abf549@changeid> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When a PM Notifier returns NOTIFY_BAD it doesn't get called with CPU_PM_ENTER_FAILED. It only get called for CPU_PM_ENTER_FAILED if someone else (further down the notifier chain) returns NOTIFY_BAD. Handle this case by taking our CPU out of the list of ones that have entered PM. Without this it's possible we could detect that the last CPU went down (and we would flush) even if some CPU was alive. That's not good since our flushing routines currently assume they're running on the last CPU for mutual exclusion. Fixes: 985427f997b6 ("soc: qcom: rpmh: Invoke rpmh_flush() for dirty caches") Signed-off-by: Douglas Anderson --- Changes in v4: - ("...We aren't notified of our own failure...") split out for v4. Changes in v3: None Changes in v2: None drivers/soc/qcom/rpmh-rsc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index 3571a99fc839..e540e49fd61c 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -823,6 +823,10 @@ static int rpmh_rsc_cpu_pm_callback(struct notifier_block *nfb, ret = NOTIFY_OK; exit: + if (ret == NOTIFY_BAD) + /* We won't be called w/ CPU_PM_ENTER_FAILED */ + cpumask_clear_cpu(smp_processor_id(), &drv->cpus_entered_pm); + spin_unlock(&drv->pm_lock); return ret; } -- 2.26.1.301.g55bc3eb7cb9-goog