Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1107561imm; Fri, 22 Jun 2018 10:26:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIn4Kd26RrjiKtUHSNm7c0FwEjjIW+o/XUAqWx3x2ubsgBOH8Lc9AyvCgZ4g9jZ4/6cuvML X-Received: by 2002:a17:902:8497:: with SMTP id c23-v6mr2671808plo.124.1529688377110; Fri, 22 Jun 2018 10:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529688377; cv=none; d=google.com; s=arc-20160816; b=NA8GBGriKLDIsxwnWujiMmqgkz2A1OqOv5BubwQX/T9IOTo62T0YKRNJmpvbdOgrvt tz8Lqbc1MO48KHBgLWkTkEqQM9cymT0iEIPGcazqwlicNcnFFfssabzCwwTlGxQEOr4G AATvNw+gQw/ghtyhyDdFBOCS18M8xsSIYNyVYFPZCLjZ4xqyJ4xe4j5+vL5w5qYLxwKw HO5vfiWNyJOXKILdGuhWCbBtToULXLxgFWvdUkKZ7Bpxn/8nynj0EOmqqb2DDOCqnxBu rA4jApMFKl5YjlqeO+/Y4OdeJ26NxmLNs6GiEtH0YOkghKmybLU7C2yTUy9PCAxiTU3R 7p+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=ESkIYAyyNkZSBx0/ZkhUioHvkR7lN7j5aPQMpOqJotU=; b=d6EQod7FJPEwQCvpLH6ZLhQThYMpVCAG24zq6rWxdFXO1P9U97TAJ9C1GVLlHCE+uq V72TajUudHT4ynL4LGlwCLGxE5oxSqbrIctoN6dvDcWAvfptVHUyfO4+FDlffwKZ6MsW dQFAzpp7h8hkDBoAJpx1YxZQo0FokgjAjfFRqHxNldt5g/CrPvzw5ZQqGR109XVXyoGD hgo01aeTB4Woj8vyfQUxj7dgNxyDUPpccXb8sZg6ZshfCKjHnneuWQ8n2GhWbNRUybb4 y5OBgE/+FSU7OVSKw6fWVkCbr+6H/F6BP7YrsJNI1zqGTl7Lzg06F9Y1yP2T/W5RU5Mi I9RQ== ARC-Authentication-Results: i=1; mx.google.com; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a21-v6si7620089pls.237.2018.06.22.10.26.02; Fri, 22 Jun 2018 10:26:17 -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; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934206AbeFVRYA (ORCPT + 99 others); Fri, 22 Jun 2018 13:24:00 -0400 Received: from mga01.intel.com ([192.55.52.88]:32277 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754264AbeFVRX6 (ORCPT ); Fri, 22 Jun 2018 13:23:58 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Jun 2018 10:23:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,258,1526367600"; d="scan'208";a="49146568" Received: from haiyuewa-mobl1.ccr.corp.intel.com (HELO [10.249.173.233]) ([10.249.173.233]) by fmsmga007.fm.intel.com with ESMTP; 22 Jun 2018 10:23:56 -0700 Subject: Re: [PATCH ] ipmi: kcs_bmc: fix IRQ exception if the channel is not open To: minyard@acm.org, arnd@arndb.de, gregkh@linuxfoundation.org, openipmi-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org Cc: luis.a.silva@dell.com, avi.fishman@nuvoton.com, openbmc@lists.ozlabs.org References: <1529636218-280096-1-git-send-email-haiyue.wang@linux.intel.com> From: "Wang, Haiyue" Message-ID: <980bbe06-afa6-67b0-a3d3-c5fd921dcfbd@linux.intel.com> Date: Sat, 23 Jun 2018 01:23:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-06-22 20:43, Corey Minyard wrote: >> Signed-off-by: Haiyue Wang >> --- >> Hi Corey, >> >> This patch looks introducing BIG modification, it should be easily >> understandable, and makes code clean & fix an error design, which >> is introduced by misunderstanding the IRQ return value. > > I'm having a little trouble understanding your text above, so let me > try to repeat > back to you what I'm thinking you are saying... > Sorry for my bad writing.... :( > You have two (or more) devices using the same interrupt, and at least > one is an > IPMI KCS device.  And interrupt comes in to the other device when the > IPMI KCS > device is not running.  The original code issues an abort when that > happens, > which is obviously incorrect.  It then returns -ENODATA, . > > When the interrupt comes in for the abort handling, the driver will > then issue > another abort, and again returns -ENODATA.  This time neither driver > handles > the interrupt, resulting in the logs. > > In general, I think the change you have here is good.  You don't want to > issue an abort in this case.  But... > > If I am right, this fix doesn't completely solve the problem.  It does > solve this > immediate problem, but what if there is an OS on the other end of the > KCS interface that sets the IBF flag?  The same situation will occur.  > In fact > it will occur even if there is only one handler for the interrupt. > > Maybe it's best to have the interrupt disabled unless the device is open. > You have to handle the interrupt disable race on a close, but with the > sync functions that shouldn't be too hard. > In fact, in BMC chip design, the LPC controller has many devices, such as Port 80 snoop, BT, KCS etc, they shares the same interrupt. :) Take AST2500 BMC as an example, please search the keyword 'interrupts = <8>' in this file: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/aspeed-g5.dtsi?h=v4.18-rc1 And may have 4 KCS channels: https://patchwork.kernel.org/patch/10318877/ This patch just enables kcs3 & kcs4, which use the same interrupt number 8. So the interrupt should be enabled always. And this IRQ issue root cause it that the IRQ handler just return IRQ_NONE if it is not opened. And for abort actions, I just put it under its related channel IBF is set. Because only IBF is set, aborting makes sense. > -corey