Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp821938ybz; Fri, 24 Apr 2020 09:50:18 -0700 (PDT) X-Google-Smtp-Source: APiQypKHWLSkCioSN7kBATl5fKuxVplCpzey5rV/Tw0C8UE60lsyqkuaRMBYkcYIxGC2srLX8jcn X-Received: by 2002:a17:906:1443:: with SMTP id q3mr2552785ejc.325.1587747017920; Fri, 24 Apr 2020 09:50:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587747017; cv=none; d=google.com; s=arc-20160816; b=HUAMMVwEsMxU/b1A8LxkOE+pJsUffjTF/WXKyAKI8tAX8drLz6XAhwQcyHn3DztAlA KTYD8vKQQLgFUHffR+nQ03IQWv6kHDZazll8KVr+mX7jXxlugwzHTTlS41+zCGJkKHlm 1q3DTxvvlcIZYUMgVR0WG2Sb2EpICqth/XZSqBrbrzuMxIrmhgN7GBJMXb8MJ8uPf2LZ PaTjVNA+AIvAI98Cr1Ujj1Bguk/vneKDTK4dlyeVhmXxmP2W6chLFKcYc8IntAQCgo8t rlTtoStGUBmzkBVdHzeFExhnldoHQKkzmgO1o1uWC/1VZ0OLZViosnKs9aF/IjYGWI83 J8+w== 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=E3KjD6DEHWViNkrcMMSN/omOCLanYpgnv+lBLaBhKo0=; b=ljL+1xbr0HmC1YyLe67mCey7oWJ45m7is/a5OuAFa+Nvp/dzbbSReLfJqBTbUhz+LS GPcqFiNVjsCKz6Ot7R5LTuc2m2h/VryOFwbTiY57THdhNrZNQFqJu2OfyExfC7v6FjBG GFUmQl76aaArHjeF740qshAdBde1YGIOKRVOuVz1aPNS1SJzCYHCKZolIFveh2xk8Cds HEEf5q9vKfNDO94NKk+wBIpZY9p8XhLLp7aik5GSYfWcwXntnK0cqR8IPTRNoSYJlMFd QFkKmT61gGRG7VEEl3KmOrT7e6czcvYnLXtxGQT+4yllBQiSd1EXYihwTYEkrUORz5oM hGFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="L/h+pXon"; 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 s22si2907372edr.441.2020.04.24.09.49.54; Fri, 24 Apr 2020 09:50:17 -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="L/h+pXon"; 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 S1728598AbgDXQrW (ORCPT + 99 others); Fri, 24 Apr 2020 12:47:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728563AbgDXQrV (ORCPT ); Fri, 24 Apr 2020 12:47:21 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D5A1C09B047 for ; Fri, 24 Apr 2020 09:47:21 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id 145so5033545pfw.13 for ; Fri, 24 Apr 2020 09:47:21 -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=E3KjD6DEHWViNkrcMMSN/omOCLanYpgnv+lBLaBhKo0=; b=L/h+pXonieUaKE73C74m7aMrsu8HHy+pR/uPK4uZDzSdlYpkfZZFlHeFh8cuAkVGnR 9LMNHSbA35LlAXdwElE2wq/ptphsPvR5QFW+Fy5fz9fznaea8oujzZldCqIkd1UBld40 xChpGFiZVBUmj51foycCY7G4sC9kIwiEVfO/g= 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=E3KjD6DEHWViNkrcMMSN/omOCLanYpgnv+lBLaBhKo0=; b=R0VatiFi5aMzuWuZbPvsDljB/XGxybvjGMCc/KaL0sIgImD8MQdxkq/8wVfCAgmNR0 uhNgGFqeECJWIcgi+l6RZ/X4uzITg5K3aRSJduN7/rMcVX/SOdtY1M4AgVyVs0UN69aP MOqTbKX0gE4DWK4L17xryntwWhRaVDoXibpADgDJ8ziswzsnzw4p8uBqilwNofcgbsW+ IyasP1Y4bLpmH3MMjhM+fX+nxQgGoKEXtj/yIG+qlmoeFfBRn2Av9o40g8C0V8+SJS3T rkXHAfiVx/WA/i1cUZQydp5andDuCoJNXxEOLI22WA3bsR2zzNoFs9ittN6abzqsU5fx d8Nw== X-Gm-Message-State: AGi0PuZDg9Kd9syKgintXSRH6hYQqQZ9/l8pd8QBMQCxZPc9YE77K9Fb uZZMFGn6yO/qC3z/WLDjUwP0uw== X-Received: by 2002:a63:f50c:: with SMTP id w12mr9858798pgh.253.1587746840689; Fri, 24 Apr 2020 09:47:20 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:1:24fa:e766:52c9:e3b2]) by smtp.gmail.com with ESMTPSA id r28sm6319205pfg.186.2020.04.24.09.47.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Apr 2020 09:47:19 -0700 (PDT) From: Douglas Anderson To: Greg Kroah-Hartman , rafael.j.wysocki@intel.com, Andy Gross , Bjorn Andersson Cc: evgreen@chromium.org, mka@chromium.org, mkshah@codeaurora.org, swboyd@chromium.org, Douglas Anderson , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/5] soc: qcom: rpmh-rsc: We aren't notified of our own failure w/ NOTIFY_BAD Date: Fri, 24 Apr 2020 09:46:54 -0700 Message-Id: <20200424094610.v5.2.I1927d1bca2569a27b2d04986baf285027f0818a2@changeid> X-Mailer: git-send-email 2.26.2.303.gf8c07b1a785-goog In-Reply-To: <20200424094610.v5.1.Ic7096b3b9b7828cdd41cd5469a6dee5eb6abf549@changeid> References: <20200424094610.v5.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 Reviewed-by: Maulik Shah Reviewed-by: Stephen Boyd --- Changes in v5: None 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.2.303.gf8c07b1a785-goog