Message ID | 20240214092902.1908443-1-pranavpp@google.com |
---|---|
Headers |
Return-Path: <linux-kernel+bounces-64969-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:bc8a:b0:106:860b:bbdd with SMTP id dn10csp1093137dyb; Wed, 14 Feb 2024 01:32:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVjLvcPk2ViMyHxFF8kfg0srtUmRdafimHaomq0tAgG3rk89M80IYqMQ0R50JF4RpdygoAFUAV/zBISSx0V3RT8wEBbrA== X-Google-Smtp-Source: AGHT+IE1ErxbWqsJ1ET1/oh9KItpDjTfDhMIDXd/2PgfXdQ8e6ryqqhLQUUimjUB1i0ES74VfTFV X-Received: by 2002:a05:6214:301d:b0:68e:f0ad:93f2 with SMTP id ke29-20020a056214301d00b0068ef0ad93f2mr2411053qvb.19.1707903124240; Wed, 14 Feb 2024 01:32:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707903124; cv=pass; d=google.com; s=arc-20160816; b=HZQ+rKzdakwLlKZJ3wkkYxxnrfDa2A01AGWm4RbOycTtbLsEA8km7cW4jor8eVoHR9 6DmAyYbwSOnq31wtC9T2yP4qbQ3TC6wSIu1dWcQD4m2gJMqIDWdQl+buVqo6xD8o+uUk 2HjXpAQw/IBK3TDZXTqLsHqkcvF38YtDpnSVlhvUuiPz/CUAZUGXctXvxuYMbqU7MVNS nr36wOVbZJCPyAnIr2zBoGJpo8/c53eNxM4GjhiA/ky0/EiPVHes3PTv9GGq8STpL0yY pA3Kn6+d2OWl01hp2hV8mkGLlbKKfk64gbEIi4XrcDqSV/rZQYDG30u8VDSCwPNMXaiG Chcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=mma7wfUNF3QcF2/p2Wj8oZ4dYl748XCEjPWFOwBXlAc=; fh=DzJWDbPhDbJsnBpWMT0TGb+nKNR0aXQZDrp1CmRNlhU=; b=LbG+bkyJYJgpMZvF6UnJ8yTPdR+lv7jJOdvXDuP6mItaPo8ArPlo9NNvcrBs/wZDkQ B5g9oJ3YlPrfDccdCF+goXWgy5dNs6NVoTlkH1365xkLXJPkkA1BbHWVTXC+266PGm0O ZTyTT2GoXNTtfcuyn/h1ZPhzfVPtjsiMtYSdDHbHt8jdhmzdy8x/VdoBM0uldgrfUfwu 5Ktz5d5B6Qx4dDIjubMnh36dvODKDeDwDwoGrJTajlBFLkeRfB/zAV2cP1Wl1BbNBdA2 5VQXqum4VTSWPPaJ1vUlSZaEuELNh3pTFBGpzA4YAJyio1oPgWjODtp9Ydzn8+9jbaoB pm2Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VhV9QM6Z; arc=pass (i=1 spf=pass spfdomain=flex--pranavpp.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-64969-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64969-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCWpPg+4r4XsVEmGhcRHoir70/ObrzstEZViCm9Fyk4/4e3dmfvrDpuj0Mm7LwVbuvhL0OIQ/H5lS7Z0q8w3NmuT+QEFdA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a12-20020a056214062c00b0068c886a3295si4891947qvx.487.2024.02.14.01.32.04 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 01:32:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-64969-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VhV9QM6Z; arc=pass (i=1 spf=pass spfdomain=flex--pranavpp.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-64969-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-64969-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 7F6051C27D78 for <ouuuleilei@gmail.com>; Wed, 14 Feb 2024 09:31:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 768EC171CC; Wed, 14 Feb 2024 09:30:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VhV9QM6Z" Received: from mail-pj1-f73.google.com (mail-pj1-f73.google.com [209.85.216.73]) (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 764E0171AC for <linux-kernel@vger.kernel.org>; Wed, 14 Feb 2024 09:30:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707903015; cv=none; b=jGRtXUL//I+wpKXsK3nJNq109QQYR8OfDsX+CfYfuFPD6/UywY0ASuswQawzZWIJZzOl9Da0agbdHbsw/ar2MRQqVwV2j1ZWsxIVKt9yTfpPlXDbq4Gnq3S2F0ILDWBJTgfHUx02GXAH8YwNMBlVZWwtHaeckqe8VS11eZAMnIg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707903015; c=relaxed/simple; bh=MZXc/+oEg/fprLTqq3So8SjUVzpTcPO4Doree43jGjc=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=KHcaOgO9SZ7FOBjzh7Csoql/+SnfEZXff0XeENiZDrsN7leQQkB71qPPm2SuHEl59fEfw0vHYZ8AkvcrojuSMKKTm8/bxl8kdbu6TuqHOCtkTJB7F5Usz8uI5rX5U5CyK/gBnn50RLRW1WSV2Kfjd55RI0ssb6PjT7qmkJDWJvQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--pranavpp.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=VhV9QM6Z; arc=none smtp.client-ip=209.85.216.73 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=flex--pranavpp.bounces.google.com Received: by mail-pj1-f73.google.com with SMTP id 98e67ed59e1d1-296f78bdb40so5374348a91.2 for <linux-kernel@vger.kernel.org>; Wed, 14 Feb 2024 01:30:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707903014; x=1708507814; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=mma7wfUNF3QcF2/p2Wj8oZ4dYl748XCEjPWFOwBXlAc=; b=VhV9QM6ZO8Ts8KYK1gtL1nLchEU2B5loY/O0XscC8dJmHCjANqOx61cHuDyWGggptv Ozgc3Q8juYncUaokDuBtiQgWw1M4s3Tp32eod4vcYlfrXtHwCSVImEyqAK2zLFeDWyf5 0eDkAkgLUr8p+XCaycGFN16KqUVrzGIoT0GyO4qTotUn17A43qEp4NjNo6+Oo55weFNT t85s5mPaeniGNGpTJ1GOljUs+DhXj+01XrRL6GZs3b6buptLMRuCmvJFFPIR0owPy8qz Xn9qQZNJBmhs8y5Ol20NrGRRPE3zXiFGGON+IR6Kwks/9iVtdyWA8qJffO3mAW1vBySy Hv9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707903014; x=1708507814; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mma7wfUNF3QcF2/p2Wj8oZ4dYl748XCEjPWFOwBXlAc=; b=lICZcZE6/gC/mx1Il+TadNjnAh+t40wP9AUmKriiox+zDVEyMkbPBncbk2d4/a0TAR iv/sXW1stvX+lGICnuEyGPUxRQivNptnpB+cD9ameQLlRWYza1c5rF1T44U90b2yxla1 wiVJCvjxcbZKsLjPKmVRBHuw8wi7tdImy/z2EQ6NfhJB/fa1itAGuaog2V3oH7WPrYab wXKr6FUXn9YmG39n55mivGe020MzWWtXW4h68TcazrYPcCX2T+97byeXpckUDuRLMKJG ZrIciA/puNFS+ZbxfV//Nm2+kZAH1qLU3e2hsFIsydOYT7oIIJ+U5Oz7KK771PQAVdGe d1yQ== X-Gm-Message-State: AOJu0YxtglrYrzRZH89NIXM4aPuj9awb17ZITDhfTElDDY3gcpd4r9wV ITaOSA4psg6wNeJQzXNao+M5ETzNCNg/hk7chKLjOQJDetJbTfxG4DSwwYNSaOSUqNngfgf388k cxAF/UlMq3w== X-Received: from pranav-first.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:390b]) (user=pranavpp job=sendgmr) by 2002:a17:90b:5288:b0:295:efdc:6abc with SMTP id si8-20020a17090b528800b00295efdc6abcmr23368pjb.5.1707903013898; Wed, 14 Feb 2024 01:30:13 -0800 (PST) Date: Wed, 14 Feb 2024 09:29:00 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240214092902.1908443-1-pranavpp@google.com> Subject: [PATCH v3 0/2] alarmtimer: Rework the suspend flow in alarmtimer From: Pranav Prasad <pranavpp@google.com> To: tglx@linutronix.de, jstultz@google.com, sboyd@kernel.org Cc: linux-kernel@vger.kernel.org, krossmo@google.com, Pranav Prasad <pranavpp@google.com> Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790866226119114932 X-GMAIL-MSGID: 1790866226119114932 |
Series |
alarmtimer: Rework the suspend flow in alarmtimer
|
|
Message
Pranav Prasad
Feb. 14, 2024, 9:29 a.m. UTC
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 amount 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 before suspend even started. This provides an opportunity to reduce power consumption if the suspend failure decision is made earlier in the suspend 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. Changes in v3 from v2: - Reversed the order of patches - Formatted variable declarations - Moved the RTC device check out of alarmtimer_get_soonest() - Reinstated the check for pending alarm in alarmtimer_suspend() Changes in v2 from v1: - Moved the pm_wakeup_event call to the PM notifier - Added a check for RTC device in the PM notifier Pranav Prasad (2): alarmtimer: Add PM notifier to check early for imminent alarm alarmtimer: Create sysfs to make alarm check window configurable kernel/time/alarmtimer.c | 164 +++++++++++++++++++++++++++++++++------ 1 file changed, 140 insertions(+), 24 deletions(-)