Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2064081rda; Tue, 24 Oct 2023 11:07:48 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKxMGUbyUk7EQXSwrccGACysX9ghAjwcnWLTKQEARmHz30Av0Y1636WESfeTfyV9KNGppA X-Received: by 2002:a05:6a21:a108:b0:132:ff57:7fab with SMTP id aq8-20020a056a21a10800b00132ff577fabmr3123734pzc.2.1698170867841; Tue, 24 Oct 2023 11:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698170867; cv=none; d=google.com; s=arc-20160816; b=b/4NgBT85i7086fq2+7wPJi2qIpHcochzC8jvpfOWrNeFtHsCtrnYMdsgdXWqcEZI7 wXYFBak+pQQYF5k+Ki5xi6uKxIUXzpnsdxOqwfnM3jsmKeTO0sK4DmTSlXMnFY0H1to8 YtD2Zs6xXOEsTWvqTw69r6c3uXF2u337iDnwfHhFJhW2R3dJunOLWn4rCWI5WENGADky MKzWfpFOn9DsBPISjyqniYNLDx/svxOH0L2fmZ0dW+OxqKx5ECSvp/dNU/BT6+ytDSte loEEUi64wS52gRaoDqJzQxzq8tkoyOZQW1v897vMjrNPKbDiQTm+F7NdfPzVCY37S6iu Va+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=KvKHj6lvKcZf5ivgAXSc25U17UutcrInn/p/8kAPU0M=; fh=YGObQLHlkDkuDEyoIv59VzU7NmpMUF+Z1A5Q7ZK5dN4=; b=Sh3SlMdirrjQlp6mOGA8AkFf6gVJSuxRVB8Z7IZdvh2lKSTpNuAS//oTW4lpfZkjaG Px99myrrAdZPSdf+KHagtYDpIix5FrMHEVHFODHdNFo9Td1JlaX9s5+yeBpdzCUCnVGF 9DySTu9hqqFqVzZaKhtHa5xGG18oKRH3h0fKIxocROH75YfJ86AFcvhzMD+p5D2zkPmC PAG3t7YEHTYTD74OF+0yd+0YAkJJZe8qelK1OKJgvDGxeUueaUEyAqxjf00v5IZNhEH7 ZbLqtvvyGu6Xm3upAOTnOHAu2BVrWXF48BDnvUkbgaE+rtOKpB03nU5v61bwHrfeacbC PI7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FcOTLCs0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id z6-20020aa79f86000000b006be15fece6csi8662316pfr.360.2023.10.24.11.07.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 11:07:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FcOTLCs0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id A2B568098B8A; Tue, 24 Oct 2023 11:07:32 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343992AbjJXSHZ (ORCPT + 99 others); Tue, 24 Oct 2023 14:07:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230304AbjJXSHY (ORCPT ); Tue, 24 Oct 2023 14:07:24 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5BC2C10CF for ; Tue, 24 Oct 2023 11:07:22 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5a824ef7a83so61314687b3.0 for ; Tue, 24 Oct 2023 11:07:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698170841; x=1698775641; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=KvKHj6lvKcZf5ivgAXSc25U17UutcrInn/p/8kAPU0M=; b=FcOTLCs0TUpC9xBu4DwT84KPBtfvV1MBMXUfIS9zn3Ikn2X0CMi7OI2foIErI4uUv9 bupyWNYzkZcuGLImd/f2XvrpxyOmPCQ+nlOcdx4g+wXSLTkCDeKT6WAiSWrKF43pzoGv +B700ywd9Cv6q2KFRVSDl35V+Ux1GD355waLfSCKq16hpmROeEY43C1KjxEMlVMUdseR lSRF0qdswveFlgTCsY4AZUrTfc6L4Dr3tx4ggHBuHMOQqIAEeCClEwZqET8EvmeaB2ip gSstcJcX8JgcVanstqZ/CBJItpwP4akK+QxoOXNUB0dF1lCLKSf3epBsUwZSWTBFMf3u MERw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698170841; x=1698775641; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=KvKHj6lvKcZf5ivgAXSc25U17UutcrInn/p/8kAPU0M=; b=CEZH0lS67ywcfjZQDIK0MYvOb0CrW+vPrR68EebdLPIMRi+e/TW82dIRr25JtZJAbt lyI39wsb3TcfxVlYuzqfn8O+M0EgM85HMx/R+2QSUmGsh+UEPoeefS4bVNdZP7FvgYC+ vr1i0E9yKwFyStGJU/FEPS/J1Kx/ZIah0XAwquUxU+ikiLkQC3lTApTaejbrkmrXwwIx Y5iXOKpBvyhr34FFEzgW83+uBYpnP4QgGvtfZ+YhuJNttmH/jfzkotZskhYX0xAoSIHm EF3fEuUQ4mahroEyYbHWeHLV4y4U3FOx6iFa8MKOBkuqqtYLa+RaTEwXZXyPIdrl7XzU q+7g== X-Gm-Message-State: AOJu0YxiiLPzyvMG+7eGiNhzbGY9trxJUCk9XLkKV0I+9vlGXQqulRkh froHQyKnp/LhKslxi46/tZYyum1AvflJ3LEnOw== X-Received: from kalesh.mtv.corp.google.com ([2620:15c:211:201:f00a:a475:d412:628f]) (user=kaleshsingh job=sendgmr) by 2002:a81:4ecf:0:b0:59b:d33b:5ddc with SMTP id c198-20020a814ecf000000b0059bd33b5ddcmr250113ywb.4.1698170841481; Tue, 24 Oct 2023 11:07:21 -0700 (PDT) Date: Tue, 24 Oct 2023 11:07:17 -0700 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.758.gaed0368e0e-goog Message-ID: <20231024180718.626055-1-kaleshsingh@google.com> Subject: [PATCH] PM/sleep: Instrument start of filesystems sync From: Kalesh Singh To: rafael@kernel.org, harry.pan@intel.com Cc: kernel-team@android.com, Kalesh Singh , Pavel Machek , Len Brown , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 24 Oct 2023 11:07:32 -0700 (PDT) Systems, such as Android, that implement opportunistic sleep from a userspace power manager service need to guard the acquisition of new wakelocks (incrementing a counter in userspace) while attempting a suspend (write to /sys/power/state). While attempting to suspend, processes attempting to acquire a userspace wakelock are also blocked. If the suspend is blocked for too long it can cause a watchdog bite in android. Some device vendors reported this issue in cases where the filesystem sync is not fast enough (sometimes > 100s): [ 2742.247785] [07-10 15:08:02.247] Filesystems sync: 107.127 seconds Commit b5dee3130bb4 ("PM / sleep: Refactor filesystems sync to reduce duplication") introduced ksys_sync_helper() which logged both the start and end of the filesystems sync. Commit c64546b17bc9 ("PM / sleep: Measure the time of filesystems syncing") improved on this by adding the elapsed time, but also removed instrumentation indicating the start of filesystems sync. Re-add the log indicating the start of filesystem sync. This helps to identify when the above scenario has occurred in production devices in the field. Cc: Rafael J. Wysocki Cc: Harry Pan Signed-off-by: Kalesh Singh --- kernel/power/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/power/main.c b/kernel/power/main.c index f6425ae3e8b0..b6a88b43b6da 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -87,6 +87,7 @@ void ksys_sync_helper(void) ktime_t start; long elapsed_msecs; + pr_info("Syncing filesystems ... "); start = ktime_get(); ksys_sync(); elapsed_msecs = ktime_to_ms(ktime_sub(ktime_get(), start)); base-commit: 05d3ef8bba77c1b5f98d941d8b2d4aeab8118ef1 -- 2.42.0.758.gaed0368e0e-goog