Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp666012ybl; Thu, 12 Dec 2019 02:59:57 -0800 (PST) X-Google-Smtp-Source: APXvYqx8hKhr1Z+3GAMztM5EAldBV8xcyi5ETpqx2GnaxiO5LQ/cpZXdw8loTmRptY70/Q9AAH75 X-Received: by 2002:a9d:6e15:: with SMTP id e21mr7369657otr.125.1576148397059; Thu, 12 Dec 2019 02:59:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576148397; cv=none; d=google.com; s=arc-20160816; b=GPIzP1cK3fqrrAPzUH9tzdR7z4UV5ikjzqu9O2BcHPClm8+G2e8HljwKsU5ianV2aC 9S8NgsWIXwHsai1xUlf05aZw4OSaaYAKk6JGxzixKrRDtj/75yD6VIHbHhMs0Jo25xQz L57RdYfkhdPQ1thhdvkfRev4EP414VJ8nLoQKW7Lw1Is4zKAMHgR9fdF7d/aNNTdw8vV qqbiIehrD57Mjz0XEM6CuEFrv+7a6FjeygtEuXh75NA7hFb4wM2BwNcDIB21yYEBKlyq XKyxwnS9k4gsUy3Y7Ej5G/pC6OwoNR6xW16OrGAGzBb5Rr0XWvXHclZAv6q+lgPo5axF zfVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=NVAO4NsxMosCRBEylhmBkoWn6ov2knzY5pHJsDnfa7I=; b=sM2ZzcN4ft0kQsucS1xlK/Ol5o9sQn9YHMhrYHgGoTeaPQDDBfgutSfSsJ/4BxQihG 8xRaq7NdrLmdmCxeT4G+Po3us/gBvxQKY2tCf73fAfsOrSHSYMItU1d6khLdFHtWr/sq +XwKN/VxQV9LFdDCdJCTJS0mm8JVsZL0uPuy+T2Tnu7ZqdzroIAOTIVsbJEp5XMDjPjX Ia5g3mIml1E4L1DrOeyVDVftsbBXotbtkOgoV90Ku+Tk1oMASYkgo3klb2DR4frH5aAd k83IDuDa8ma8xHPHRoYFOok7LoyW53NWnw7dqPRDZ6arPRDtXZhO2sX0rx5kdn2RofqY VXsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=dxnweIl6; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r21si2976760otd.276.2019.12.12.02.59.44; Thu, 12 Dec 2019 02:59:57 -0800 (PST) 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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=dxnweIl6; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728891AbfLLK7O (ORCPT + 99 others); Thu, 12 Dec 2019 05:59:14 -0500 Received: from pandora.armlinux.org.uk ([78.32.30.218]:56934 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728777AbfLLK7N (ORCPT ); Thu, 12 Dec 2019 05:59:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=NVAO4NsxMosCRBEylhmBkoWn6ov2knzY5pHJsDnfa7I=; b=dxnweIl6bWU44iMtkgtbb38WH 6Vgw7Mw7Cu9YmlufX1PCxC7DkzrkiObt0ibqAu2qHWg8CWherkYCL/OOlpK/Hcco8xv4lK3oG+iuW zNhtrtSGbIbEf9d1Ej2O93OhTmuzb5Bf1Pxw0qBtg6hPgwJbak5e9FYncgBY/8zWdbQGGbnkxuXC+ Bq3GMPxQQJiIb6VsUisaqLrr+MMCKiche4wSnBWEabM0Ot9YzV3mUuFNUAfy4CSFfE9vu+Q4O7obn o8yEl0cgPKmybjZEMxc+ffqN60M781lzWdLro9IA37tup/D2o+EZM+Ig97HD2+De7HLoOoWVZY4An R3IdArweg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:51932) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ifMBS-00069r-91; Thu, 12 Dec 2019 10:59:02 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.92) (envelope-from ) id 1ifMBN-0006gn-MP; Thu, 12 Dec 2019 10:58:57 +0000 Date: Thu, 12 Dec 2019 10:58:57 +0000 From: Russell King - ARM Linux admin To: Peng Ma Cc: "shawnguo@kernel.org" , "s.hauer@pengutronix.de" , "linux-kernel@vger.kernel.org" , "linux@rempel-privat.de" , Abel Vesa , Aisheng Dong , Anson Huang , Bogdan Florin Vlad , BOUGH CHEN , Clark Wang , Daniel Baluta , Fancy Fang , Han Xu , Horia Geanta , Iuliana Prodan , Jacky Bai , Joakim Zhang , Jun Li , Leo Zhang , Leonard Crestez , Mircea Pop , Mirela Rabulea , Peng Fan , Peter Chen , Ranjani Vaidyanathan , Robert Chiras , Robin Gong , Shenwei Wang , Viorel Suman , Ying Liu , Zening Wang , "kernel@pengutronix.de" , "festevam@gmail.com" , "linux-arm-kernel@lists.infradead.org" , "linux-i2c@vger.kernel.org" Subject: Re: [EXT] Re: [PATCH] i2c: imx: Defer probing if EDMA not available Message-ID: <20191212105857.GE25745@shell.armlinux.org.uk> References: <20191127071136.5240-1-peng.ma@nxp.com> <20191128100613.GI25745@shell.armlinux.org.uk> <20191211104347.GA25745@shell.armlinux.org.uk> <20191211114230.GC25745@shell.armlinux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 12, 2019 at 03:09:32AM +0000, Peng Ma wrote: > Hello Russell, > > Thanks very much for your strict guidance and comments. > I realized it is hard to us that we want to i2c used edma when edma > probe after i2c probe. I have no problem with that aim. I'm just very concerned by the proposed implementation, especially when it has already been proven to cause regressions in the kernel. I seem to remember that the infinite loop caused other issues, such as the system being unable to complete booting. > I look forward to discussing with you as below, if you like. > Thanks. > > You say I could do this: > "So, if you want to do this (and yes, I'd also encourage it to be > conditional on EDMA being built-in, as I2C is commonly used as a way > to get at RTCs, which are read before kernel modules can be loaded) > then you MUST move > i2c_imx_dma_request() before > i2c_add_numbered_adapter() to avoid the infinite loop." > > Even if I do this, It's hard to avoid the infinite loop of i2c probe caused by EDMA(build-in) initialization failure. It isn't clear what you mean here. If EDMA fails to probe (because fsl_edma_probe() returns an error other than EPROBE_DEFER) then of_dma_find_controller() will return NULL. That will be propagated down through i2c_imx_dma_request(). This is no different from the case where EDMA is built as a module. It is also no different from the case where EDMA hasn't yet been probed. If i2c_imx_dma_request() is placed after i2c_add_numbered_adapter(), and EPROBE_DEFER is propagated out of i2c_imx_probe(), then _yes_, it will cause an infinite loop, because you are replicating the exact conditions that caused the attempt to propagate i2c_imx_dma_request()'s return value to be reverted last time - which brought the kernel to a grinding halt. If i2c_imx_dma_request() is placed before i2c_add_numbered_adapter(), then there is no infinite deferred probing loop - yes, i2c_imx_probe() will be called as a result of other drivers successfully probing, and each time it will return EPROBE_DEFER, but the _key_ point is that the action of i2c_imx_probe() will not _self trigger_ the deferred probing _and_ place itself onto the deferred probe list. Please, rather than continuing to send emails arguing over this point, investigate the stated issue with some practical tests: 1. Make i2c_imx_probe() propagate i2c_imx_dma_request()'s return value, as it did in the original patch. 2. Build i2c-imx into the kernel. 3. Build edma as a module. 4. Build and test boot the kernel and check what happens. 5. Move i2c_imx_dma_request() before i2c_add_numbered_adapter() 6. Build and test boot the resulting kernel and note any differences. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up According to speedtest.net: 11.9Mbps down 500kbps up