Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1252984pxb; Thu, 21 Oct 2021 19:33:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPA6vK4lrJdDwzhUC4cMnPTqgeFB0FZ5CAD1/HWvA+26vKHZvlD9rm/NRTlX/UugL/0KiF X-Received: by 2002:a17:906:38ce:: with SMTP id r14mr11663052ejd.268.1634869990587; Thu, 21 Oct 2021 19:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634869990; cv=none; d=google.com; s=arc-20160816; b=htUdiNp45cm4pwG52DyOw+ih1ooRlrPRuVn753dLrVzK/rmFRKy1TCU0HTIe4MDZat jmgLHZozMSZ7rCi7hxRP3rrV+4wDGBQqF7kCNQnizuVJZOErTAVDDX6335dgNhScEN+S MQUBx7AvK0b5XEcrdiJ9LbFAFXQRBxYaglVVJKXk4FjKH/npC3aVm+C9/Cq2Xa7aGN7c 2BNmlMoMXCKYxkgw1453g+7nxXeV1Xz7O+ypUYzmPxX3YRsTFZkvpWqIgIryEsESdLkA gMe98Xjj825ONPS57Ky2eM7Ybp06hY2CetLrGHIywLfT9oGtaxUcLdsBDM765aIcEi5j GgqA== 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:mime-version:message-id:date :dkim-signature; bh=5ZMpMtjR+wLOolLwIfiGLGJ0aQUfB1I4d9AgzhjDlQE=; b=lsGJcSIAb69ywoqTav0tUGW695+tGBzU/vOuRugJMryoFFtyvxVdpLLxulsBFfofSI tf3MmHYD/yxpt00SXfcnpohTj8DCl2xCtKw8VkLsvcgt3rJd4qsj93RQ15E02Zvbd6Hx Yzjg9oTRr7h5A7PMOq8CpRbo8zqEsg4FwGkxni81oETzQUcTu9bx7QPC4lGJdBctcLfs TTn1pOMHsT0Dds+CCtN4peNMVAG2M6cRu5Ew4WC7S6iojEGWizUa6cwOs2OwnRXm9CgV 5Pd0O+qKlAFUHDBKmQ3txcz5Dfwrk8tbwEtGsMfcb7pry3Js8CD/A0xT7KMl8NkTM9e2 fLUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=SMUDcX7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lk14si8921400ejb.687.2021.10.21.19.32.47; Thu, 21 Oct 2021 19:33:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=SMUDcX7n; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232125AbhJVCbX (ORCPT + 99 others); Thu, 21 Oct 2021 22:31:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232130AbhJVCbW (ORCPT ); Thu, 21 Oct 2021 22:31:22 -0400 Received: from mail-pj1-x1049.google.com (mail-pj1-x1049.google.com [IPv6:2607:f8b0:4864:20::1049]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BB6DC061764 for ; Thu, 21 Oct 2021 19:29:05 -0700 (PDT) Received: by mail-pj1-x1049.google.com with SMTP id jz23-20020a17090b14d700b001a1d69b0215so947223pjb.4 for ; Thu, 21 Oct 2021 19:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:message-id:mime-version:subject:from:to:cc; bh=5ZMpMtjR+wLOolLwIfiGLGJ0aQUfB1I4d9AgzhjDlQE=; b=SMUDcX7nCULVnXJiTLztKbrv7nsnJyfQto4brqP12SZrZqIDlHUN7HpIfWrxUNAuof VNuf9o+sJsUy89BJbqJYJSh88KZVFT7oA7scSZgdfuHoMysrOskKowt22ya+H+bNE2bt 7qsqNuAd8mXQyQPPBG4nLL7Pty+MZtKECe9FrIOxjzSpKMDx+kWKn+3C3lm6aV6OHW7d tgf9493Vi78nzGjs9ieoPjidtrct3BeAisWlxFhmqW7BUhixVWMIE32jbK+EFLWgQ8Yh ka5jsqSWrcygTUVRW2aMsbQGwFtJfdZu9zgwhvwlObW9Eub+Xb341Eoh1rlkHi0FfpLu vmMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=5ZMpMtjR+wLOolLwIfiGLGJ0aQUfB1I4d9AgzhjDlQE=; b=n+AEvJ1wqddf65AQuoT0n0QzEm3bK1Bz23VYmNRWf1J7PpewgEJFiwF4AjQ0Q1WxMf ekd0sLOwjO+x0tcNAW+n1GIqQq0M/r60XdnXqN2I//JFOLkC3qGXmPNT72+6PIhjE2hX SVGxZA5A7T42kN1ACtBJK1LXeM72Rk376ZtsUlnKiAsWUm0q+brHysL/wiU4FOCCZnqx cDAIp1qH/2oZoIC9O5qg44k21QCWsnBSg8qZGouOFpaZIgXWV0kMXBrphMq8awOO0RKW iSFCDLOygPQqQHYZEPzpXyXIz6egQ8dzROcWPmaaMsNHR+ZfdOAtdc3peWdaI7GolRPZ CuIw== X-Gm-Message-State: AOAM530lXGXs18ak5hEAxWtcc/0T2INWaK1XT0ZM4AeVC+N7NEJTAx7w /psudEg67gG/ttM1qdS9Aesm6Uap+F+U X-Received: from rajat2.mtv.corp.google.com ([2620:15c:202:201:cc25:d9a3:4b5:37b9]) (user=rajatja job=sendgmr) by 2002:aa7:8bd3:0:b0:44c:68b3:a52e with SMTP id s19-20020aa78bd3000000b0044c68b3a52emr9578300pfd.74.1634869744744; Thu, 21 Oct 2021 19:29:04 -0700 (PDT) Date: Thu, 21 Oct 2021 19:28:56 -0700 Message-Id: <20211022022859.1888836-1-rajatja@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog Subject: [PATCH 0/3] i2c: Enable async resume for i2c devices From: Rajat Jain To: Jarkko Nikula , Andy Shevchenko , Mika Westerberg , Wolfram Sang , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, dtor@google.com Cc: Rajat Jain , rajatxjain@gmail.com, dbasehore@chromium.org Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org PM Core allows buses and drivers to specify if they'd like their devices to suspend/resume synchronously or asynchronously. When resuming: 1) SYNCHRONOUS DEVICES: - All synchronous devices (system wide!) are resumed in a single thread, serially i.e. one after the other. So their resume latencies add up, and also, this results in unnecessary and unnatural waiting order. In my current system (total resume time ~895ms) and this is the trend on almost all chromebooks in the past 3-4 years (we carry patch3 in our tree already, without which it would be even more worse): https://rajatxjain.github.io/public_shared/resume_before_patches.html As you can see I2C devices do not even begin to resume until 450ms, waiting unnaturally for another device i915 to finish resuming: I2C touchscreen device (resume latency = 374 ms) - asynchronous -> (waiting on) I2C adapter resume (synchronous) -> (waiting on) Designware resume (synchronous) -> (waiting on) intel_backlight resume (synchronous) -> (waiting on) its PARENT i915 resume (asynchronous resume time = 376ms) As you can see the two biggest resume routines are both run serially after one another (even though they don't have any real dependency) thus increasing the system critical resume path. If we can run them concurrently, we can cut down the system resume time considerably. 2) ASYNCHRONOUS DEVICES: - On the other hand, all asynchronous devices's resume routines are scheduled so they can run in parallel with other asynchronous routines. PM core still ensures for both async/sync devices that: - All parent child relations are honored. - Any device dependencies are honored. Device dependencies between any 2 unrelated devices can be specified using device_link_add(). - Async resume devices are sychnronized at the end of each suspend/resume phase, before moving onto next. With these patches in place, the I2C devices can resume in parallel with i915: https://rajatxjain.github.io/public_shared/resume_after_patch.html As far as I understand, the only reason we might not want a device to be marked for asynchronous resume is if we suspect it cannot handle concurrent resume with other devices, which does not look to be the case. This patchset marks the designware, the I2c adapters, and the i2c clients for asynchronous suspend/resume. In case it helps to gain any confidence, the patch 3 (for i2c clients) has been included and shipping on all our chromebooks for the past 3+ years, and has not shown any issues. The designware and i2c adapters should be easier. Derek Basehore (1): i2c: enable async suspend/resume on i2c client devices Rajat Jain (2): i2c: designware: Enable async suspend / resume of designware devices i2c: enable async suspend/resume for i2c adapters drivers/i2c/busses/i2c-designware-platdrv.c | 2 ++ drivers/i2c/i2c-core-base.c | 2 ++ 2 files changed, 4 insertions(+) -- 2.33.0.1079.g6e70778dc9-goog