Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp844647rdb; Mon, 29 Jan 2024 23:20:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHNOJu0dGB7MZKdm5iUasWut5PxHBw7PNfrLBVKDsiaigF4LiKLhbWqFh2qV6C7nlHF5n31 X-Received: by 2002:a05:6512:1599:b0:510:286b:8882 with SMTP id bp25-20020a056512159900b00510286b8882mr5957222lfb.3.1706599232988; Mon, 29 Jan 2024 23:20:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706599232; cv=pass; d=google.com; s=arc-20160816; b=tL2T9QWPzTYUw/irfUxU3FLTe5QhHFXz3V72wQx4W90RVB64QRiYtOADZmTlwXhwKK dibKAvdFUyD3Pa3Y13mL5Sd8QdN6qsE2X55RLKTjvwcU2k1Qr+6N5TKwJn9/D2jCwsr5 R6wLBquLMlfgmKdK87qyOAcGX43V7YBnsOzzK9ZC/UKpPGFc6HHMhOsAoYJlJ80cai63 GTjhJbZVh68X7RRQNxoTulCk/Su5M70Q7dJ2M/82Vh8eHcpVZg3IZSs9w2fbYS4pZc32 AOYS5DMW8C7x0WchjCBflwlGHq3CuGt/yoBnVTmcu1NL04Br52ZixOINQz96btM5gEUl okrw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=kaRvCP+UZ6Ics0fGz+aED0wpVeQwY7XKWgJvHWCBXbg=; fh=3lCNSO6LQCqhm4IvCPXj5H7Te/C8INRvRb78PtOk2Ps=; b=dhn1VntaaTGtSPm0QV/PobF3Vklm18SO1Fa4DkkGq4vkkZzQ8LtTk2Mnwo68E54p6Y +imhVyHuBOYfocja+KTJBVDlgNZ82aup4IcSUazlYLcjwy+zxdMLSPR/Ww3d27hxX5i8 RU5eUZekpqXQOy+YYDiP01P8g4EjnRS7VhDiWdY38wL9UBgpsbXltuZ00WbpVLl8lSkX /6Kv2rWPvCOuoUaL52dk836OPlkoKjC77Bx/DbMCpT5pzGC3P1V3U57jtc4MJd9jJsvO +iB7Tiv6ZDKXTwICvygFcd7BbgJpZGaIAUbJRL77q79sZiF7FUuhNSaumGpUo0HjGyOt 7uZg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Uel/6Lg+"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-44033-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44033-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id i10-20020a1709061e4a00b00a360a6e87e4si619632ejj.400.2024.01.29.23.20.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jan 2024 23:20:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44033-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="Uel/6Lg+"; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-44033-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44033-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 8E8EE1F26C1E for ; Tue, 30 Jan 2024 07:20:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4585D4F1EE; Tue, 30 Jan 2024 07:20:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Uel/6Lg+" Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D369555C2D; Tue, 30 Jan 2024 07:20:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.55.52.88 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706599217; cv=none; b=FMFejVP9fsS+LpJl0l1lq6LHCKbO7Q3uKvkRCtaaCxiRKpE87lqTlEH/Dpanig2Ki8XbdgD7/lqtTMEdTuvY5uDuJuOlYjTek1euRJpO03VMmdPTU+zi/APAEUhfL/gFuHsmd3kYU0baIm/XMEqaXmbsnwvttbDVslEZRZ3CX1A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706599217; c=relaxed/simple; bh=50of1iRlpyR0+qBELyvikrNaqZ2J5lBZByuAj1ASK+w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Gx8N7iHlyyWd6RAjQC3ddl2gRtjsZL0OSvjOjXzUB8I9eDnGdA/WKrgR8DQTKQ+zqUD5hyVxNRGD02rohc4WiPmHjuIyauxV1t+qr+Q5ee74/l24bRX1qdbryk9DvVzEcSddNCd+asEDViB2u2GuIUC9AjTO2Q2GCpx4Mjx21Lk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Uel/6Lg+; arc=none smtp.client-ip=192.55.52.88 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706599215; x=1738135215; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=50of1iRlpyR0+qBELyvikrNaqZ2J5lBZByuAj1ASK+w=; b=Uel/6Lg+JOIYhGj0igtH7gl3GDIb7XVrccBuuBCWHm4kMwwW6ThF/GTt B8h60Y07cf7/67CCYvYAaFj4NSmCGbdgKFK9gPzxi2U2+JCkh/60MyjOc 81QdugcbKTzP3spFBUH40FcBJq4MRXPB7wfqPPIGZMqD9LzmOESFBr31e AqrtAECVW4r1YZQ9K1tl/yAGQJ9g6/lS8uW0uOczVTEvR276RyZHRppvr xpMY4DwYm9ynchbwaIKrc3BNkuImPSZCxVK1Kc2tB9oFAqQXn4qwYRtEI /HDcRvn+YEnAfHoD94ctAm/Sc4HI3WfXEHNMExFua8l30vKDe6mJnrQZM w==; X-IronPort-AV: E=McAfee;i="6600,9927,10968"; a="434366340" X-IronPort-AV: E=Sophos;i="6.05,707,1701158400"; d="scan'208";a="434366340" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2024 23:20:14 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,707,1701158400"; d="scan'208";a="29802214" Received: from sgruszka-mobl.ger.corp.intel.com (HELO localhost) ([10.252.42.115]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Jan 2024 23:20:13 -0800 Date: Tue, 30 Jan 2024 08:20:10 +0100 From: Stanislaw Gruszka To: "Rafael J. Wysocki" Cc: Linux PM , LKML , Ulf Hansson Subject: Re: [PATCH v2 05/10] PM: sleep: stats: Call dpm_save_failed_step() at most once per phase Message-ID: References: <5770175.DvuYhMxLoT@kreacher> <23401570.6Emhk5qWAg@kreacher> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <23401570.6Emhk5qWAg@kreacher> On Mon, Jan 29, 2024 at 05:24:04PM +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > If the handling of two or more devices fails in one suspend-resume > phase, it should be counted once in the statistics which is not > guaranteed to happen during system-wide resume of devices due to > the possible asynchronous execution of device callbacks. > > Address this by using the async_error static variable during system-wide > device resume to indicate that there has been a device resume error and > the given suspend-resume phase should be counted as failing. > > Signed-off-by: Rafael J. Wysocki Reviewed-by: Stanislaw Gruszka > --- > > v1 -> v2: No changes. > > --- > drivers/base/power/main.c | 20 +++++++++++++++++--- > 1 file changed, 17 insertions(+), 3 deletions(-) > > Index: linux-pm/drivers/base/power/main.c > =================================================================== > --- linux-pm.orig/drivers/base/power/main.c > +++ linux-pm/drivers/base/power/main.c > @@ -685,7 +685,7 @@ Out: > TRACE_RESUME(error); > > if (error) { > - dpm_save_failed_step(SUSPEND_RESUME_NOIRQ); > + async_error = error; > dpm_save_failed_dev(dev_name(dev)); > pm_dev_err(dev, state, async ? " async noirq" : " noirq", error); > } > @@ -705,6 +705,9 @@ static void dpm_noirq_resume_devices(pm_ > ktime_t starttime = ktime_get(); > > trace_suspend_resume(TPS("dpm_resume_noirq"), state.event, true); > + > + async_error = 0; > + > mutex_lock(&dpm_list_mtx); > pm_transition = state; > > @@ -734,6 +737,9 @@ static void dpm_noirq_resume_devices(pm_ > mutex_unlock(&dpm_list_mtx); > async_synchronize_full(); > dpm_show_time(starttime, state, 0, "noirq"); > + if (async_error) > + dpm_save_failed_step(SUSPEND_RESUME_NOIRQ); > + > trace_suspend_resume(TPS("dpm_resume_noirq"), state.event, false); > } > > @@ -815,7 +821,7 @@ Out: > complete_all(&dev->power.completion); > > if (error) { > - dpm_save_failed_step(SUSPEND_RESUME_EARLY); > + async_error = error; > dpm_save_failed_dev(dev_name(dev)); > pm_dev_err(dev, state, async ? " async early" : " early", error); > } > @@ -839,6 +845,9 @@ void dpm_resume_early(pm_message_t state > ktime_t starttime = ktime_get(); > > trace_suspend_resume(TPS("dpm_resume_early"), state.event, true); > + > + async_error = 0; > + > mutex_lock(&dpm_list_mtx); > pm_transition = state; > > @@ -868,6 +877,9 @@ void dpm_resume_early(pm_message_t state > mutex_unlock(&dpm_list_mtx); > async_synchronize_full(); > dpm_show_time(starttime, state, 0, "early"); > + if (async_error) > + dpm_save_failed_step(SUSPEND_RESUME_EARLY); > + > trace_suspend_resume(TPS("dpm_resume_early"), state.event, false); > } > > @@ -971,7 +983,7 @@ static void device_resume(struct device > TRACE_RESUME(error); > > if (error) { > - dpm_save_failed_step(SUSPEND_RESUME); > + async_error = error; > dpm_save_failed_dev(dev_name(dev)); > pm_dev_err(dev, state, async ? " async" : "", error); > } > @@ -1030,6 +1042,8 @@ void dpm_resume(pm_message_t state) > mutex_unlock(&dpm_list_mtx); > async_synchronize_full(); > dpm_show_time(starttime, state, 0, NULL); > + if (async_error) > + dpm_save_failed_step(SUSPEND_RESUME); > > cpufreq_resume(); > devfreq_resume(); > > >