Received: by 2002:ab2:2997:0:b0:1ec:cbc4:63fb with SMTP id n23csp331007lqb; Thu, 29 Feb 2024 02:09:58 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCUk0mFWdDLno0Xd021mgV21kjAZ/BBIPOqlJt9spCQTkV/ph4PpOocHkgziBgmpITX8Lq6ukQxjjgXLVDXgSq9lSz9iU2zNHAg/oemSuA== X-Google-Smtp-Source: AGHT+IHYd3EMxY7PgUjMz9Xy4O9/h94qJ3ykf8RsRHxrT6AOmiMAqFE+HcyulPyg+UaU17c7aIar X-Received: by 2002:a05:6808:1889:b0:3c1:5557:5615 with SMTP id bi9-20020a056808188900b003c155575615mr1995390oib.47.1709201398332; Thu, 29 Feb 2024 02:09:58 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id z11-20020aa79e4b000000b006e558d339f4si977618pfq.276.2024.02.29.02.09.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 02:09:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-86517-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@google.com header.s=20230601 header.b=rSkbaSN0; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-86517-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-86517-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=REJECT sp=REJECT dis=QUARANTINE) header.from=google.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id F0C9828B0CF for ; Thu, 29 Feb 2024 10:09:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7183463CB4; Thu, 29 Feb 2024 10:09:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="rSkbaSN0" Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF59A62A06 for ; Thu, 29 Feb 2024 10:09:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709201363; cv=none; b=jBW1/HkCVjy9rPwEKJIDkJoyjbiS/+gqCe1+zqbPHG5tSQDL9sMCi+8FhL89BDOuab4XcLXPN76gur9MRdta/rbcjuHspEuMYAAnDFk+UPgtVavJwItAX/d1M/6/cTH9FE4bQHLclTtxRr58bVKU96MkM3KWNvzEDveawm46+OM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709201363; c=relaxed/simple; bh=GA3hOk2+V3le+4muvMPKWEzM4CFPwWUnDODB09RfE4U=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=jRk2rXr4KK4DDd8oZ5akK/Cz1H84qBadTzYTKkLXGr5gMWmU+cCyFCdKFGY4hax5LF8RpnZeErLWfini/BOlwEVHOYNiF8lkKFUTCYWvn+174zT97ZVmBYxuDY4w+mUD8fpnwgw2o2suNYppObYUpProXhZChcxb40im06iO5x0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=rSkbaSN0; arc=none smtp.client-ip=209.85.208.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-5654ef0c61fso10148a12.0 for ; Thu, 29 Feb 2024 02:09:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709201360; x=1709806160; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=t/Go3YqIu09UH/h/HOYTGKZUGAGfZufH1m+hGfleaeo=; b=rSkbaSN0te7psnftf8RVCKwTkY/RIDX6i5cjqo/wDTV3qvx8Pmbvd65epK2qKkIjRV 69Gx5DoTlzMfuDHTe1DwsokSBe2J1BeA0Sev107ppxJnKf2GqMEJvYKiGEvgj3w3/1xp 0cSqEiCcyJozHyiqrX1k6zzDo4gdzQrp5FnEhetcSXTnAZ7xntuBjADi2MyjCgZTKKrC JGBHsdq+iN83J8TInKH/zKF+9VLCGTgNam/fCCTT6H/L8LxttAO9Ii+TAtsWWWxF85s+ FRKK4yKL80KyOS5OgxUqxIBARzbGBMUOWmc/e/KBFJbu8Qi13FqYphgBy9/vFuRsP1c2 2xhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709201360; x=1709806160; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t/Go3YqIu09UH/h/HOYTGKZUGAGfZufH1m+hGfleaeo=; b=ux69MU/bJR7FzQPxl0ha/wfTh+pc4U8w9lMEmEVbqeSLEN7A51mhzUI8JKSBtXZeLs mSTfA1Hi7UWXxS3QpITa6hxTAEpOwXBDh09JKJcaDt3y/XrIHm5P77QjLejj4f/ykiC6 xD5HeVl3xcTLCCbu652Q+0ahCZO6Bg3Fe2rWUgXuH4Wd7MPwxma554MtY3JM81+p7oso IziuD+CSO0TPuCwRGI/C3PMvtCdWDPafK9MLwkLyvMa7kOB7V1pV89Qc9JGEm0aOchJb 20OYXXjtz2fUZPLodaVusYehNhnB2lrrlNSaj2RaTbWc4Gn+o6lF5HjHvjAtqQqk16dq j68A== X-Forwarded-Encrypted: i=1; AJvYcCWR1PTWgKyKIvzgBlkBvPLsc3REw4a2ziPQFeQaJ3Lc7v7NfGwB+4IpnPajmlLEMK3bu4IQNFs3MQqlISWx8MqCWvXpCO6uow5NcjXu X-Gm-Message-State: AOJu0YzDPRlgLC63KWehMj1WSyop4zJA/K3fvoXcUkRCC9bj4Cy1Rb5Y 8JqwgAe6U1ISXBInhpqb6mhcBrDgIFgZZ0bLbPwbxOXMJQhHVCVWWb+hMd4X9dpJjCUPA+G5Og3 RP3/Zt+4fWVeSNNGpQT+WSXlAXHsH5Zv3ePJt X-Received: by 2002:aa7:dcc5:0:b0:563:f48a:aa03 with SMTP id w5-20020aa7dcc5000000b00563f48aaa03mr103397edu.2.1709201360039; Thu, 29 Feb 2024 02:09:20 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240223143833.1509961-1-guanyulin@google.com> In-Reply-To: From: Guan-Yu Lin Date: Thu, 29 Feb 2024 18:09:00 +0800 Message-ID: Subject: Re: [PATCH v3] PM / core: conditionally skip system pm in device/driver model To: "Rafael J. Wysocki" Cc: pavel@ucw.cz, len.brown@intel.com, gregkh@linuxfoundation.org, andriy.shevchenko@linux.intel.com, rdunlap@infradead.org, james@equiv.tech, broonie@kernel.org, james.clark@arm.com, masahiroy@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Feb 27, 2024 at 7:28=E2=80=AFPM Rafael J. Wysocki wrote: > > On Mon, Feb 26, 2024 at 10:45=E2=80=AFAM Guan-Yu Lin wrote: > > > > On Sat, Feb 24, 2024 at 1:44=E2=80=AFAM Rafael J. Wysocki wrote: > > > > > > On Fri, Feb 23, 2024 at 3:38=E2=80=AFPM Guan-Yu Lin wrote: > > > > > > > > In systems with a main processor and a co-processor, asynchronous > > > > controller management can lead to conflicts. One example is the ma= in > > > > processor attempting to suspend a device while the co-processor is > > > > actively using it. To address this, we introduce a new sysfs entry > > > > called "conditional_skip". This entry allows the system to selectiv= ely > > > > skip certain device power management state transitions. To use this > > > > feature, set the value in "conditional_skip" to indicate the type o= f > > > > state transition you want to avoid. Please review /Documentation/A= BI/ > > > > testing/sysfs-devices-power for more detailed information. > > > > > > > > Signed-off-by: Guan-Yu Lin > > > > > > Please explain how this is intended to work. That is, what exactly > > > you expect to happen when the new attribute is set. > > > > The sysfs entry 'conditional_skip' for a device indicates which power > > transitions (e.g. PM_EVENT_SUSPEND) are omitted within the system > > power management flow. During the processing of an identified power > > transition, the device's power.entry will not be added to the > > dpm_prepared_list, preventing the device from undergoing that > > transition. As 'conditional_skip' is modifiable at runtime, a device's > > participation in system power management can be dynamically enabled or > > disabled. > > So this idea is completely misguided AFAICS. > > First off, why would a device be skipped in system-wide suspend and > not in hibernation? Or the other way around? Or why would it be > skipped in one phase of hibernation and not in the other? > The motto is to set less constraints and let users configure them properly by themselves. But, we could redesign it to better match with existing conventions/regulations. > Second, but not less important, why is skipping a device in > system-wide transitions a good idea at all? What about dependencies > between that device and the other devices in the system? > If a device is also used by another operating system kernel, then Linux kernel shouldn't always do the system power transition on that device to avoid affecting another operating system kernel. Since device dependencies can be highly system-specific, maybe we should let users handle it as users are the only ones who understand their system's unique configuration. > Generally speaking, system-wide PM is designed to cover the entire > system and there are good reasons for that. If you don't want it to > cover the entire system, you cannot use it at all. We discovered a use case that the existing system-wide PM may not fully support: devices shared by multiple operating system kernels. I think supporting this case would be beneficial to the system-wide PM, as it would increase its compatibility.