Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp733882imm; Wed, 17 Oct 2018 07:31:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV60iLthZLK50ANuS0clj+4UtfCoagb8m/W8UVumtUyJnfRcvmWEzLrWo0GYExkPWemPMRnAm X-Received: by 2002:a63:6385:: with SMTP id x127-v6mr24553506pgb.10.1539786689389; Wed, 17 Oct 2018 07:31:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539786689; cv=none; d=google.com; s=arc-20160816; b=RoUb8sI2rbbQziDT1JVYiGOWdGQN95hWAN5/4+ePUKxJ/XGH+JtD+3m2UvOloZd+pe 56Mo3qZJePaJxjmF2ft578cbDt3KWJMNQ9YLJtV1Mm/Cq3sDNZp52w80/FzOXOT5vTZr Qin/WBXdV+3sH1jOrzxUpGgaayXWpMQfAFqSIVv6n5GhQWZx2rOhipUS5+l1yDRguz4O 2RnonZ2ow7EABaPFj8yVsk8f3TTDsH8oDbUpAjLaAB97TZYeHyC97X9V7QbcXiEt8Wwz tcR03/CsuOAjNuFb4srjSNsemwr9uqhHh+jqmt255zfggD0mYqLF74rt5nM/aHXdz0bA K1mA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=ieKC4jnguOktgK7S+Fbd/wjEU+7sItu4oRaVek0xahQ=; b=zYTYlMBwmdunN1qkmwR4vEtDpgO+Q3fnN3C17NNSckqhgm9/UpIYnbSfuNmfjh1Dm+ 6anBUOTCJw7dmlb73PYlD30+8s8S3L2HqE0tVlsZwWe21H1D19eHjjuw/prk04Byg0ZU MnwMXxtOy0BSgZOX0CO3opIvt+/ed5ZIjMcjeu6/atd0VYP+UXd8mgE58arICwSoUH8e MtfbyJTmTtDuOELRg3apIN5YRbDk4kuqBnLm/X6TY4rRHq63bTWQDm6rH0fkIIGszy32 x/NWo1wDxC2C2ekjvgqpqtbt5r1fsJ2B0Ybof8iHHZj+CFENYdcr2SdHiP3fE05ALAvj 2H7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TP7CEH7g; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b59-v6si12330100plc.257.2018.10.17.07.31.13; Wed, 17 Oct 2018 07:31:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=TP7CEH7g; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727700AbeJQW0R (ORCPT + 99 others); Wed, 17 Oct 2018 18:26:17 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:39784 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727054AbeJQW0R (ORCPT ); Wed, 17 Oct 2018 18:26:17 -0400 Received: by mail-lj1-f196.google.com with SMTP id p1-v6so24549639ljg.6; Wed, 17 Oct 2018 07:30:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ieKC4jnguOktgK7S+Fbd/wjEU+7sItu4oRaVek0xahQ=; b=TP7CEH7gJ9l9IrvxfMPOXXhsrtzCE6SbLFfxjDhtxZWbz9846Te2Uw0jmsAwptztS9 ZzHZ0HBaaIErqTNMJ+wj/qzE9NrOtu8C27gTuQndP80qZ5ZVMXfqW99orPUw1TzIYT3O e6KsMpA0O57spmK9vFE63+nQoQf1CWztXvWX7dP9/AjpHhASY+GJBCjhfIGFj5o4gSL2 EBdsZqlWsHg6JZh/N3il5E5sNUJzvRe+aHYVyF71ezVataEqOjbKXVMQo1hiDhBnFcLm q10sWpircIenpBV9uiNtqvVCJ0C2HBza2ubOHHkGmIhuN/2pxEklu7S/C7BqTLwotbWS fKpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ieKC4jnguOktgK7S+Fbd/wjEU+7sItu4oRaVek0xahQ=; b=fLTdKa2aIg4/8m9PRe7/uT0AnCLEsZZsR26xXJfUNhM+f2uSOFjyfrfR0oP+a3piTx jdgsRacmSj7hPKw9rqQf2T1Aq7MD2GVMTO/iw8+SK/sqIGchJSP83+dS1EoiXsaKMAEe rrPoxFQMNkrI3F36b+/Wd8ztnG21yYJwUesdwCXHd3Obf/6khBGwTfHEofgNwnNQW5TX dpP8x7ZqzB2MeFnQRZlEeSQsO2fK8FjfZlpnzy/p4lUIfM4S/HlLTrJzHpQyRArR1E5L dyevejkHyY/XSP/gd+jBvy2za2SmnumLT+YzGHgPjmdQmqa8iF0sNnofeNjufoPfGApU a+Sg== X-Gm-Message-State: ABuFfoijimWebHmHaQkJTt1G5gJIvIkIPj3hvX63BXdVWnfIUu6OFjbf WTz1EgVKGjV11VLKc6oexgdJY9eX X-Received: by 2002:a2e:651d:: with SMTP id z29-v6mr18484327ljb.36.1539786616976; Wed, 17 Oct 2018 07:30:16 -0700 (PDT) Received: from [192.168.2.145] (109-252-91-118.nat.spd-mgts.ru. [109.252.91.118]) by smtp.googlemail.com with ESMTPSA id m19-v6sm418311lfj.39.2018.10.17.07.30.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 07:30:16 -0700 (PDT) Subject: Re: [PATCH v1] i2c: tegra: Remove suspend-resume To: Jon Hunter , Wolfram Sang , Thierry Reding , Laxman Dewangan Cc: linux-tegra@vger.kernel.org, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180513211347.7187-1-digetx@gmail.com> From: Dmitry Osipenko Message-ID: <47eaced9-761d-b8d0-2f43-41bf3dd050cc@gmail.com> Date: Wed, 17 Oct 2018 17:30:15 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/17/18 4:59 PM, Jon Hunter wrote: > > On 13/05/2018 22:13, Dmitry Osipenko wrote: >> Nothing prevents I2C clients to access I2C while Tegra's driver is being >> suspended, this results in -EBUSY error returned to the clients and that >> may have unfortunate consequences. In particular this causes problems >> for the TPS6586x MFD driver which emits hundreds of "failed to read >> interrupt status" error messages on resume from suspend. This happens if >> TPS6586X is used to wake system from suspend by the expired RTC alarm >> timer because TPS6586X is an I2C device driver and its IRQ handler reads >> the status register while Tegra's I2C driver is suspended, i.e. just after >> kernel enabled IRQ's during of resume-from-suspend process. > > I have been looking at the above issue with the tps6586x because I am > seeing delays on resume caused by this driver on the stable branches. I > understand that this patch was dropped for stable, but looking at the > specific issue with the tps6586x I am curious why the tps6586x driver > was not fixed because it appears to me that the issue largely resides > with that driver and any other device that uses the tps6586x is > susceptible to it. I was able to fix the tps6586x driver by doing the > following and I am interested in your thoughts ... > > Subject: [PATCH] mfd: tps6586x: Handle interrupts on suspend > > The tps6586x device is registered as an irqchip and the tps6586x-rtc > interrupt is one of it's interrupt sources. When using the tps6586x-rtc > as a wake-up device from suspend, the following is seen: > > PM: Syncing filesystems ... done. > Freezing user space processes ... (elapsed 0.001 seconds) done. > OOM killer disabled. > Freezing remaining freezable tasks ... (elapsed 0.000 seconds) done. > Disabling non-boot CPUs ... > Entering suspend state LP1 > Enabling non-boot CPUs ... > CPU1 is up > tps6586x 3-0034: failed to read interrupt status > tps6586x 3-0034: failed to read interrupt status > > The reason why the tps6586x interrupt status cannot be read is because > the tps6586x interrupt is not masked during suspend and when the > tps6586x-rtc interrupt occurs, to wake-up the device, the interrupt is > seen before the i2c controller has been resumed in order to read the > tps6586x interrupt status. > > The tps6586x-rtc driver sets it's interrupt as a wake-up source during > suspend, which gets propagated to the parent tps6586x interrupt. > However, the tps6586x-rtc driver cannot disable it's interrupt during > suspend otherwise we would never be woken up and so the tps6586x must > disable it's interrupt instead. > > Fix this by disabling the tps6586x interrupt on entering suspend and > re-enabling it on resuming from suspend. Looks like it should work, but I vaguely recalling that something didn't work after disabling of IRQ on suspend. Maybe wakeup was getting disabled, but seems it is working fine now. Patch is good to me if you're going to propose it for backporting, but you should test that it works properly with all of stable kernels. I just found this [0], seems your patch need to address the same review comment. [0] https://lkml.org/lkml/2011/3/29/18