Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp455465rdh; Wed, 7 Feb 2024 09:25:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IFTJccvkWuga6VK4Lei2ISOvILelB9tsfSxhAYx6LWzvh5gUtYg+ggSae39QlxVWhhmg/sc X-Received: by 2002:a05:6a20:720a:b0:19e:4e58:b251 with SMTP id y10-20020a056a20720a00b0019e4e58b251mr154369pzb.10.1707326704967; Wed, 07 Feb 2024 09:25:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707326704; cv=pass; d=google.com; s=arc-20160816; b=pEfRhSWsR4dJlG9qvGVBKEzwUkvY4YifSyLqNnmEx76Z6YG9PJcpuHcZ8XCAmLGm9d maycM03fQnVga9wvN12+JbuKqafQbVcg8BUFoPTVhor54B/hoVCK1jm09T29Oc1VMtLn OjX6l/9eYWe+wEYPKnNOVxWo2w7xG87hZinnDiNvS2u+7nv1o2QyaSNgRPhpnLKMLZrF aVfWAIWJvuyUcfLCD/fDCZw27l3WWCVu1CdqJNt91rFCnG7lBsUyuDwY7c4eCCvjekpa aMHKLBclVsKIBTTus0D0H02EwrcLsX+UJ/VF9hgE5RwzWfgF5zyyB/aD1b8IFYnbp0MR QBwQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=2DTvCS76/e8jai8Lk1LPsUrtKHnibkC66/Oj/foOwb0=; fh=bsCFqe06Gq1lKUr954dkPi5HSeGmj8yMHVADO4u7bqQ=; b=afjgeGq/CjMOjqnFtiHGH/niPGQecman4ToJxAX2I4gYLuKy4fk4T1hEbj78tmYDjP vAHcrHKqwwv9lt/y+O4irsffuKQgrSrT0hlh5enhyUhimPYH639f1rGJjuAwEfdNnf+X RRheLZefmp37mwIJd4WmKf4Pu25ozYkpgatnCC0WkcfyQaLve9jZCBlGpxaXK0PQLRMv bw9uJj+vT6RE1T+ztKqQzJ0Pp67UbfRlXoPRhKbQdWaPnLTgtzhxDsCyzWAqmUvshbHo mVksX9fmR3vodDuaK/ueqIpyfCZ5pKR7S9KbjUez7f+2G1PrAkJn8i7pLY5m0YIGJy60 y1OA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=uX323w5t; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-56818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCUKpzsUyRnmkPFhWdrsf00/ftgaYEgeAYxZTvF4Z2YjNHpDIVnc9kDy+OYnr0fxu53W4in6mklE06zaKEhauzqf6MmLmK5E8kH4fRdj/g== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id x24-20020a63b218000000b005d849f5352csi1925289pge.795.2024.02.07.09.25.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 09:25:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=uX323w5t; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-56818-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56818-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 57A10B24C61 for ; Wed, 7 Feb 2024 17:17:15 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5FE8E823C5; Wed, 7 Feb 2024 17:17:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uX323w5t" Received: from mail-ed1-f49.google.com (mail-ed1-f49.google.com [209.85.208.49]) (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 B7B25811EC for ; Wed, 7 Feb 2024 17:17:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707326226; cv=none; b=XoVUZMRZCY9A+wzLdflKLLynIqA+7VrgyPa5/Q7TSC3RpG3Xomrg0jkUaWMmn+3J46IUhjvc2/hwtspKUn5n0zqu0JaxxrwydvawYLx1et1xzwXgkBkh+xb4CC+wcjJK+dy3+OZO9qG1UD5+eHfDG/GenZZi7sepm8CyFAXE63U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707326226; c=relaxed/simple; bh=SlVgvMr9mTs5h6+GHURwDx1gzJGKB04YlXeMNaq1X2E=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=iGg5yOAgXrQicT/uqpevVrHVanVwMoQlFPKvTvyzOd7JJDXXuVcn0AGzPetnFfSlYX9ZI9YffhnjL0jbjpVLtPJYxzgmc0vmpsXhFeHV57USOVOMROC9xVpbpROMSQToA0vNNr6tdbZM9E7OR1NdqrAU+THg3DDnBsRdS2SBlUM= 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=uX323w5t; arc=none smtp.client-ip=209.85.208.49 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-f49.google.com with SMTP id 4fb4d7f45d1cf-560c696ccffso55384a12.1 for ; Wed, 07 Feb 2024 09:17:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707326223; x=1707931023; 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=2DTvCS76/e8jai8Lk1LPsUrtKHnibkC66/Oj/foOwb0=; b=uX323w5tuBwH0FCUUseIuFmyZJjW8f+Uq8ApWFSviYabNL0FnEdejflJK2a/VIFs1i hZMbdg706oi5VnMeBb0wEXhXQtBbyGsTAqD2MvT4RNjZ/3tqp9pd5Bv07Yh+EgXlSKnh /3KXDxaMz1A5mZBXOzsY+8/YAhwkLZzOwhxyT1Q6tU24GYKRpv3rxPGD+oSU6tZVY9RU uys7SGkil38dTyquBr93I9G4vJvAfubcXn2LtoKwGWMHk+3syl+wC/bWH9TqU3lwaeFK hGvWkF6NDhR0BNMTex8O7YtkpRlj92+cLaaQRQh31COvV3W2567OPsGNZITKu26G+ClK dL6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707326223; x=1707931023; 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=2DTvCS76/e8jai8Lk1LPsUrtKHnibkC66/Oj/foOwb0=; b=cNvm++8yjxJ2DPrRNz79zilA9JgtylwN/7hByQZg+0hPaA6McqDmUY5ymjs4SBJpum jKOGazC5JFVWQME5fXLLgsSi1iarynKgOGEWyztmU2xI/jEzTaIWGQd/9RDWzVPwyWzz w74mmFUqMmbXCRevWiK4l1qDMB11zjwuUN9YQWk+WWQLlNTtFRIU8v9EU+6v5tkhv2Bt kE9h+Cu1G2l7FtO46wZNM3ofoqz7wOSK7qNguVh0r/DQPMHpGrDVIreY0Dawty33KIw+ IjEu23MNDFexflOJnY8kv4XZUFPtn+daJLH9e26Xp03AY5ZvrzVCoUdcZ2NlWaMvnHD8 S5Ew== X-Gm-Message-State: AOJu0YzncMI5ClNZsekShEyw3ZYH7lkkCp+81MplCdlaM3gwL4/4r8Fl tlKbszNv35Fx6lQu8F3ZsZ9fdxw2XqB23aUoWVnS5MxckVxOJs3rWL9vSvIIv712I/tj87ZswBp m7Yr7jBBIhdaLj8GTRWTr43x/LZPCQ3EIPhoc X-Received: by 2002:a17:906:71d0:b0:a38:5443:f4e0 with SMTP id i16-20020a17090671d000b00a385443f4e0mr136841ejk.19.1707326222768; Wed, 07 Feb 2024 09:17:02 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240207100619.3947442-1-pranavpp@google.com> In-Reply-To: From: Pranav Prasad Date: Wed, 7 Feb 2024 09:16:51 -0800 Message-ID: Subject: Re: [PATCH 0/2] alarmtimer: Rework the suspend flow in alarmtimer To: tglx@linutronix.de, jstultz@google.com, sboyd@kernel.org Cc: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 7, 2024 at 2:06=E2=80=AFAM Pranav Prasad = wrote: > > Hi! > > During the driver suspend phase of kernel suspend, alarmtimer's suspend > callback is invoked and it identifies the earliest next wakeup alarm and > programs that into the HW real time clock (RTC). However, there is an > exception to this process. If the next alarm is within the next 2 seconds= , > the alarmtimer driver fails to suspend. In this case, a non-trivial amoun= t > of power is spent to freeze and unfreeze all userspace processes and to > suspend and resume a number of devices. In the vast majority of cases, th= e > imminent alarm that caused the failure was likely already scheduled befor= e > suspend even started. This provides an opportunity to reduce power > consumption if the suspend failure decision is made earlier in the suspen= d > flow before the unnecessary extra work is done. This patch series aims to > achieve a kernel suspend flow in which the check for an imminent alarm is > performed early during the suspend prepare phase. > > Pranav Prasad (2): > alarmtimer: Create alarmtimer sysfs to make duration of kernel suspend > check configurable > alarmtimer: Modify alarmtimer suspend callback to check for imminent > alarm using PM notifier > > kernel/time/alarmtimer.c | 178 +++++++++++++++++++++++++++++++-------- > 1 file changed, 144 insertions(+), 34 deletions(-) > > -- > 2.43.0.594.gd9cf4e227d-goog > Please ignore this patch series, submitting v2 with some more suggested fix= es. Pranav On Wed, Feb 7, 2024 at 8:46=E2=80=AFAM Pranav Prasad = wrote: > > Please ignore this patch series, submitting v2 with some more suggested f= ixes. > > Pranav > > On Wed, Feb 7, 2024 at 2:06=E2=80=AFAM Pranav Prasad wrote: > > > > Hi! > > > > During the driver suspend phase of kernel suspend, alarmtimer's suspend > > callback is invoked and it identifies the earliest next wakeup alarm an= d > > programs that into the HW real time clock (RTC). However, there is an > > exception to this process. If the next alarm is within the next 2 secon= ds, > > the alarmtimer driver fails to suspend. In this case, a non-trivial amo= unt > > of power is spent to freeze and unfreeze all userspace processes and to > > suspend and resume a number of devices. In the vast majority of cases, = the > > imminent alarm that caused the failure was likely already scheduled bef= ore > > suspend even started. This provides an opportunity to reduce power > > consumption if the suspend failure decision is made earlier in the susp= end > > flow before the unnecessary extra work is done. This patch series aims = to > > achieve a kernel suspend flow in which the check for an imminent alarm = is > > performed early during the suspend prepare phase. > > > > Pranav Prasad (2): > > alarmtimer: Create alarmtimer sysfs to make duration of kernel suspen= d > > check configurable > > alarmtimer: Modify alarmtimer suspend callback to check for imminent > > alarm using PM notifier > > > > kernel/time/alarmtimer.c | 178 +++++++++++++++++++++++++++++++-------- > > 1 file changed, 144 insertions(+), 34 deletions(-) > > > > -- > > 2.43.0.594.gd9cf4e227d-goog > >