Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1123070imm; Wed, 17 Oct 2018 13:50:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV63zntfhEFm5r5cnONpZ2b6oBzUJD+kZfFUSSc87gpuO7WYejygc66/iayYfPmxUB1Wy0J8J X-Received: by 2002:a63:c5a:: with SMTP id 26-v6mr25805528pgm.372.1539809452251; Wed, 17 Oct 2018 13:50:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539809452; cv=none; d=google.com; s=arc-20160816; b=FlYIiX/lt9VvOI5rq1t7K41Tt9f/CZSuhkctXIbxWTamCwrMAOmzfaxVd35yLe9kY5 RnW2dmUtH6DKSGmoEW9W5sdXaGVGMiO5D+tDNErw+qaDCFWp9hi2SbdmJI1bh958JiPQ K6r+Xf9tML7gGFrf6k1zxpVclShSdSBywqIDS9UPfjplazkWY1jBnEeHPiseMidq+rQD yx3yE4qY7Vhbi4vk/coUCTZ3ORgRFQ6LwwhpwlpKE+joukSNl4UoCViDmjLAWEPBhUUR 61SOryQbjqnJ4tAGtC+ajLIWfObK0Qzw/ytMLhcKjwlnvKmkw95JpwvA2YfffH/PY+Sj JR3w== 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=gO2xsugPFExqWrI5vcKZaLQPN8jH9y8vY8w//y93DB0=; b=i7YFOWPQzD8n+yOzVpDR1tGXbcPtyUj8cjUpmUcJu/SpdESQqhwaFcuhNsel7UhL8r WBqVCOgZpJY1gbYluBMBctvNCJAA8ITAhMu3IUHq6JmjxEsgJPx6DSysUGnG2BDXD2Cc w88Xt0y/nLdJASzDHJoSquFS5gztdFX6ufz2MbJzB9srBkEjdOErT3h6xwnEvn5k7fOY okd/mukua/V/HDbejTNuf1qjgOAaswIPUY01p1RcH0Vm06hP1L93ouwcMQA2YNmIUQ/i H+nDcGfoAlaPOTTHcVLr8zQSApamIDtoyopGQQpJOHtfIyALGZC82veBR+haj4QNFty8 8q8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UG10uTBU; 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 u18-v6si18236489pgl.59.2018.10.17.13.50.36; Wed, 17 Oct 2018 13:50:52 -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=UG10uTBU; 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 S1727280AbeJRErT (ORCPT + 99 others); Thu, 18 Oct 2018 00:47:19 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:39547 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726009AbeJRErT (ORCPT ); Thu, 18 Oct 2018 00:47:19 -0400 Received: by mail-lf1-f67.google.com with SMTP id n14-v6so9045438lfe.6; Wed, 17 Oct 2018 13:49:50 -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=gO2xsugPFExqWrI5vcKZaLQPN8jH9y8vY8w//y93DB0=; b=UG10uTBUOlvWmlhuz/dFrYYt8P8JljgN3KEyfYtnqOncP00FBy5NTGk6vCkkrzuDGx tNOJPuhSwZGEc2ZXrRvaYxhEtayQ1uJIN2IW1xjHBdoji+KZLTOtsLmz5lGGe5dc/kqx bzalfdKB1+4AIw4GNU+bIiV2rsPvUHvZ7E9I7Q1Ph0D4bgUbWOpk35CCRrtyL5Lu7H4P zH+N3rPki9pI5wHJC6ny0JcdbaSEkoj5eP2s+EidS7+Tn2GoZE2wPQH0bpMUVhXNqLyu mxi4pMCcXfOSjqMO08h2Zp2OyATKBtgl2DINiAc2s79urjl/swLZGXrDeosAtH1/BVcF gqbg== 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=gO2xsugPFExqWrI5vcKZaLQPN8jH9y8vY8w//y93DB0=; b=IVoXb6mC3XxtoC3dTBS0t3Hv6tnHPFr9QrJH7NOxgSe+2DLPcxJENXQbTTAtB+rsUw sFL9il/HMxtyn5/avqxhXsOjy9Q3ZcEIwirrGiX5hqVG1AygXG6fV4VfyglaLSSMd6mc 1ieMCieLFx5TlqaMQsNWwtLaU0l5dWizc/W7asbfRLsaYonm1tsRCMon4EVU3f3GGGdv IKBHEl4o8QHGHFKA3FMR6pEaGfKDcoOdPWMXZK0HPgfhlpPdKafkgVmgVQhlnFCNhP6S q8nf9IoyEFgrAKkTQk/KR8d7abuC2coIYA4ADeR8FiOzU5pi2H29naIk6DJv8ZSHCud7 lDVg== X-Gm-Message-State: ABuFfohUkQzDyTmiCmQmk+0z36EjLUyBiBtDQQ5rthErCrjKfXFBETBS /RKeQgVdQ5zODbuS9r7ctT9iF0rR X-Received: by 2002:a19:9f8c:: with SMTP id i134-v6mr16315140lfe.52.1539809389107; Wed, 17 Oct 2018 13:49:49 -0700 (PDT) Received: from [192.168.2.145] ([109.252.91.118]) by smtp.googlemail.com with ESMTPSA id g64-v6sm2852197lfe.87.2018.10.17.13.49.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Oct 2018 13:49:48 -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> <47eaced9-761d-b8d0-2f43-41bf3dd050cc@gmail.com> <87168ccb-65f5-0ac3-8451-ccc2159d99df@nvidia.com> From: Dmitry Osipenko Message-ID: <27a1f887-8bb0-7016-c6ff-310ff897e516@gmail.com> Date: Wed, 17 Oct 2018 23:49:46 +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: <87168ccb-65f5-0ac3-8451-ccc2159d99df@nvidia.com> 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 10:41 PM, Jon Hunter wrote: > > On 17/10/2018 15:30, Dmitry Osipenko wrote: >> 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. > > Indeed, I have been setting up some automated testing of various stable > branches (mainly 4.x LTS releases) and I am seeing this problem there. > Furthermore, I am using this to validate the change as well. > >> I just found this [0], seems your patch need to address the same review comment. >> >> [0] https://lkml.org/lkml/2011/3/29/18 > > Thanks will do. > > I know we don't support low power modes (ie. LP0), however, I do wonder > if we should have some sort of i2c suspend/resume handler for Tegra? > Eventually we will need this. I'd suggest to support LP0 in the core first and only then to start making necessary suspend/resume changes in the drivers, otherwise it may end up being wasted time and effort for you and other maintainers.