From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2F38C433F5 for ; Thu, 3 Mar 2022 14:14:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233203AbiCCOPR (ORCPT ); Thu, 3 Mar 2022 09:15:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59958 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230329AbiCCOPO (ORCPT ); Thu, 3 Mar 2022 09:15:14 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 691FA18C7B4; Thu, 3 Mar 2022 06:14:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646316869; x=1677852869; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=5QG9h5lx2anIO5uIyhVHkmCiySJytsOAX/CGcMce8NM=; b=LbxnWVSe5MLrk+r0E9HQpM3q9hRl+sToWPrC+eziFpgNYkhGwgHOisJy Yskv1fe5pwch43V6V2lZ3SSv3cmdJ7eoJnLrJ6qcRaHC3b/N6SH1akHoY 1blNHAgunH0GSoB2qlXd3fit6HMGZbE6R6ZgtdrMFW8XLILNt+6ZT6TWx 2Dt2ghoVS7Ds7hUb0MFs3FGCObASTm0tnfMgGqhLAEt8GEpoq2c8FMMHI 9vnwBnGMyCSbjb0FtCQ7QHcf15xB2NKymHX86Y8DmuCcSkPAXQe/XieJV aeAS2snnVB71ewA2X92snXNkwM6nNHbwye4ZuGSl9ed31/scJlWNZLP5n Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10274"; a="251258796" X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="251258796" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2022 06:14:29 -0800 X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="511442309" Received: from smile.fi.intel.com ([10.237.72.59]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2022 06:14:22 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nPmD0-00ApIt-Ho; Thu, 03 Mar 2022 16:13:34 +0200 Date: Thu, 3 Mar 2022 16:13:34 +0200 From: Andy Shevchenko To: Tali Perry Cc: Tyrone Ting , avifishman70@gmail.com, Tomer Maimon , Patrick Venture , Nancy Yuen , Benjamin Fair , Rob Herring , Krzysztof Kozlowski , yangyicong@hisilicon.com, semen.protsenko@linaro.org, Wolfram Sang , jie.deng@intel.com, sven@svenpeter.dev, bence98@sch.bme.hu, lukas.bulwahn@gmail.com, arnd@arndb.de, olof@lixom.net, Tali Perry , Avi Fishman , tomer.maimon@nuvoton.com, KWLIU@nuvoton.com, JJLIU0@nuvoton.com, kfting@nuvoton.com, OpenBMC Maillist , Linux I2C , devicetree , Linux Kernel Mailing List Subject: Re: [PATCH v3 09/11] i2c: npcm: Handle spurious interrupts Message-ID: References: <20220303083141.8742-1-warp5tw@gmail.com> <20220303083141.8742-10-warp5tw@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 03, 2022 at 02:48:20PM +0200, Tali Perry wrote: > > On Thu, Mar 3, 2022 at 12:37 PM Andy Shevchenko wrote: > > > > > > On Thu, Mar 03, 2022 at 04:31:39PM +0800, Tyrone Ting wrote: > > > > From: Tali Perry > > > > > > > > In order to better handle spurious interrupts: > > > > 1. Disable incoming interrupts in master only mode. > > > > 2. Clear end of busy (EOB) after every interrupt. > > > > 3. Return correct status during interrupt. > > > > > > This is bad commit message, it doesn't explain "why" you are doing these. ... > BMC users connect a huge tree of i2c devices and muxes. > This tree suffers from spikes, noise and double clocks. > All these may cause spurious interrupts to the BMC. > > If the driver gets an IRQ which was not expected and was not handled > by the IRQ handler, > there is nothing left to do but to clear the interrupt and move on. Yes, the problem is what "move on" means in your case. If you get a spurious interrupts there are possibilities what's wrong: 1) HW bug(s) 2) FW bug(s) 3) Missed IRQ mask in the driver 4) Improper IRQ mask in the driver The below approach seems incorrect to me. > If the transaction failed, driver has a recovery function. > After that, user may retry to send the message. > > Indeed the commit message doesn't explain all this. > We will fix and add to the next patchset. > > > > > + /* > > > > + * if irq is not one of the above, make sure EOB is disabled and all > > > > + * status bits are cleared. > > > > > > This does not explain why you hide the spurious interrupt. > > > > > > > + */ > > > > + if (ret == IRQ_NONE) { > > > > + npcm_i2c_eob_int(bus, false); > > > > + npcm_i2c_clear_master_status(bus); > > > > + } > > > > + > > > > + return IRQ_HANDLED; -- With Best Regards, Andy Shevchenko From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 29959C433F5 for ; Thu, 3 Mar 2022 14:16:11 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4K8Y1h4Sl1z3c3f for ; Fri, 4 Mar 2022 01:16:08 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Rs2I15/4; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=linux.intel.com (client-ip=134.134.136.65; helo=mga03.intel.com; envelope-from=andriy.shevchenko@linux.intel.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Rs2I15/4; dkim-atps=neutral Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4K8Y0z1XFNz3byZ for ; Fri, 4 Mar 2022 01:15:30 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646316932; x=1677852932; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=5QG9h5lx2anIO5uIyhVHkmCiySJytsOAX/CGcMce8NM=; b=Rs2I15/4SDjrHXUQs+XC1HB6qA864oqaRZelXuAf314Jn099QtKrWvGG BGoi1UeuCxXNnt0cuyVUtfOeUCGGOiRI+qyirR16Wz2iovS1/nRx47beN fx3ieo4vC3AjymIBkvOFxPR6jVY+3xDsrFvKmEcNa/WsnMX8894wD/2hv SVbSfHFDMAbM79Eoo4Ddj/+oXetq3zS/PLVDmAMWGaZxNEnZDqvwwvQ+9 NwYU9AY96mQltA06Gnisibh79v88HtoCix7uSbtd8GGyC7EkCu4fLhx1F JyA1Iz9i14XHbeJSNxqzMRrH8Misene87YYtH/mtRkctASFwEMh+eK0sD g==; X-IronPort-AV: E=McAfee;i="6200,9189,10274"; a="253614377" X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="253614377" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2022 06:14:29 -0800 X-IronPort-AV: E=Sophos;i="5.90,151,1643702400"; d="scan'208";a="511442309" Received: from smile.fi.intel.com ([10.237.72.59]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Mar 2022 06:14:22 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nPmD0-00ApIt-Ho; Thu, 03 Mar 2022 16:13:34 +0200 Date: Thu, 3 Mar 2022 16:13:34 +0200 From: Andy Shevchenko To: Tali Perry Subject: Re: [PATCH v3 09/11] i2c: npcm: Handle spurious interrupts Message-ID: References: <20220303083141.8742-1-warp5tw@gmail.com> <20220303083141.8742-10-warp5tw@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tomer Maimon , devicetree , yangyicong@hisilicon.com, Linux I2C , Benjamin Fair , Krzysztof Kozlowski , OpenBMC Maillist , JJLIU0@nuvoton.com, lukas.bulwahn@gmail.com, tomer.maimon@nuvoton.com, KWLIU@nuvoton.com, bence98@sch.bme.hu, arnd@arndb.de, sven@svenpeter.dev, Rob Herring , Avi Fishman , Tyrone Ting , semen.protsenko@linaro.org, jie.deng@intel.com, avifishman70@gmail.com, Patrick Venture , Linux Kernel Mailing List , Wolfram Sang , kfting@nuvoton.com, Tali Perry , olof@lixom.net Errors-To: openbmc-bounces+openbmc=archiver.kernel.org@lists.ozlabs.org Sender: "openbmc" On Thu, Mar 03, 2022 at 02:48:20PM +0200, Tali Perry wrote: > > On Thu, Mar 3, 2022 at 12:37 PM Andy Shevchenko wrote: > > > > > > On Thu, Mar 03, 2022 at 04:31:39PM +0800, Tyrone Ting wrote: > > > > From: Tali Perry > > > > > > > > In order to better handle spurious interrupts: > > > > 1. Disable incoming interrupts in master only mode. > > > > 2. Clear end of busy (EOB) after every interrupt. > > > > 3. Return correct status during interrupt. > > > > > > This is bad commit message, it doesn't explain "why" you are doing these. ... > BMC users connect a huge tree of i2c devices and muxes. > This tree suffers from spikes, noise and double clocks. > All these may cause spurious interrupts to the BMC. > > If the driver gets an IRQ which was not expected and was not handled > by the IRQ handler, > there is nothing left to do but to clear the interrupt and move on. Yes, the problem is what "move on" means in your case. If you get a spurious interrupts there are possibilities what's wrong: 1) HW bug(s) 2) FW bug(s) 3) Missed IRQ mask in the driver 4) Improper IRQ mask in the driver The below approach seems incorrect to me. > If the transaction failed, driver has a recovery function. > After that, user may retry to send the message. > > Indeed the commit message doesn't explain all this. > We will fix and add to the next patchset. > > > > > + /* > > > > + * if irq is not one of the above, make sure EOB is disabled and all > > > > + * status bits are cleared. > > > > > > This does not explain why you hide the spurious interrupt. > > > > > > > + */ > > > > + if (ret == IRQ_NONE) { > > > > + npcm_i2c_eob_int(bus, false); > > > > + npcm_i2c_clear_master_status(bus); > > > > + } > > > > + > > > > + return IRQ_HANDLED; -- With Best Regards, Andy Shevchenko