Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp582462imm; Fri, 29 Jun 2018 03:01:10 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKhSJWFg+aI0NWX+BJRkZTW9fvIDiMsMMZUyxCusHYh0M+UuPQnd4TT5Hywdx8GQ42nXStg X-Received: by 2002:a65:6689:: with SMTP id b9-v6mr12004768pgw.326.1530266470140; Fri, 29 Jun 2018 03:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530266469; cv=none; d=google.com; s=arc-20160816; b=NLCff+yWjMiqqQOBaRRytb1gtRu6sBmtyApWJNP5bIlnYMpRmO+s/RzkvRzizZ63/s RsUjvZ590ah5tLKHG5Tt3Lju4K1qNHk2sXCzmThGB6FBe8maV3nvlzMkNnx9SeC/NwjE Ts2nQd9b13Bu251t3O4umrN5AvAz07vtOBEWK/D4ZPA4bVRwLydsRHQqzCMvDPY0Gg1I Z2vKZq5nc23NM2auOEuwPbTGYOa/RgVrSFumNHwd926jEvgxNJfHRo583nq6sV9uSc1h eHXZMDaZYiYjL3dwZUfatxOC+xdxQjxWXRjJ5duDMObPKdEoWINvy36qv09kDOV9MyO9 sI/w== 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:arc-authentication-results; bh=QtRroQsRUb7mR5OUTPSxcruyvPtLbh0fo2nVdJDSl/A=; b=wUtsNI5ESvSbvxpzvLpPVFA4inoRsuMN/lOwBTvRPksKif5czAZFSKd3GdcKiUaDUF PTzrFNhBXTBedall7FYD6f+T3JwAijfBysFC6mWbARykUn4rVrw6kAMWOwf45xxn1AW+ 6vZE3ljLyFYvzfRsjEhi3yYLzginEK+FzukBq53UDKGTkkYcAI8SW5pRScWXCzRtOCi3 2rty5JnNpm1Q94zEYT970+fmlcnHeTOEjamEvh4r4YsJr0P8XCTWVNFGNKx1QJwk6dFo l8AtZWpM5o+lf1ibjUYRn863CNFCd0OXvBl9XZQoNwaXWFt2nwDg6ik+tIkoSwyo2Lsa cSZQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t5-v6si5804405plz.286.2018.06.29.03.00.55; Fri, 29 Jun 2018 03:01:09 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754566AbeF2Jhr (ORCPT + 99 others); Fri, 29 Jun 2018 05:37:47 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:58294 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752491AbeF2Jho (ORCPT ); Fri, 29 Jun 2018 05:37:44 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 908BA18A; Fri, 29 Jun 2018 02:37:44 -0700 (PDT) Received: from red-moon (unknown [10.1.206.55]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3888D3F266; Fri, 29 Jun 2018 02:37:42 -0700 (PDT) Date: Fri, 29 Jun 2018 10:39:27 +0100 From: Lorenzo Pieralisi To: Dexuan Cui Cc: Bjorn Helgaas , 'Bjorn Helgaas' , Haiyang Zhang , "'linux-pci@vger.kernel.org'" , KY Srinivasan , Stephen Hemminger , "'olaf@aepfle.de'" , "'apw@canonical.com'" , "'jasowang@redhat.com'" , "'linux-kernel@vger.kernel.org'" , "'driverdev-devel@linuxdriverproject.org'" , "'vkuznets@redhat.com'" , "'marcelo.cerri@canonical.com'" Subject: Re: [PATCH] PCI: hv: Fix a __local_bh_enable_ip warning in hv_compose_msi_msg() Message-ID: <20180629093927.GA9576@red-moon> References: <20180613221509.GB12463@bjorn-Precision-5520> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 13, 2018 at 10:50:05PM +0000, Dexuan Cui wrote: > > From: Bjorn Helgaas > > Sent: Wednesday, June 13, 2018 15:15 > > > ... > > > It looks Lorenzo's pci.git tree has not been updated for 3+ weeks. > > > I guess Lorenzo may be on vacation. > > > > > > @Bjorn, can this patch go through your tree? > > > Should I resubmit it? > > > > No need to resubmit it, Lorenzo has been out for a bit, but I'm sure > > he'll pick this up as he catches up. > OK, I see. Thanks! > > > You might, however, fix the commit log: > > > > This is not an issue because hv_pci_onchannelcallback() is not slow, > > and it not a hot path. > > > > This has at least one typo (I think you mean "and *is* not a hot > > path"). > Sorry -- yes, it's a typo. I hope Lorenzo can help to fix this, or I can > resubmit it if Lorenzo or you want me to do it. > > > I also don't understand the sentence as a whole because the > > hv_pci_onchannelcallback() comment says it's called whenever the host > > sends a packet to this channel, and that *does* sound like a hot path. > Sorry for not making it clear. > The host only sends a packet into the channel of the guest when there > is a change of device configuration (i.e. hot add or remove a device), or > the host is responding to the guest's request. > > The change of device configuration is only triggered on-demand by the > administrator on the host, and the guest's requests are one-off when > the device is probed. > > So IMO the callback is not a hot path. > > > I also don't understand the "hv_pci_onchannelcallback() is not slow" > > part. In other words, you're saying hv_pci_onchannelcallback() is > > fast and it's not a hot path. And apparently this has something to do > > with the difference between local_bh_disable() and local_irq_save()? > > > > Bjorn > Actually in my original internal version of the patch, I did use > local_irq_save/restore(). > > hv_pci_onchannelcallback() itself runs fast, but here since it's in a > loop (i.e. the while (!try_wait_for_completion(&comp.comp_pkt.host_event) > loop), IIRC I was asked if I really need local_irq_save/restore(), > and I answered "not really", so later I switched to local_bh_disable()/enable(). > > However, recently I found that if we enable CONFIG_PROVE_LOCKING=y, > the local_bh_enable() can trigger a warning because the function > hv_compose_msi_msg() can be called with local IRQs disabled (BTW, > hv_compose_msi_msg() can also be called with local IRQS enabled in > another code path): > > IRQs not enabled as expected > WARNING: CPU: 0 PID: 408 at kernel/softirq.c:162 __local_bh_enable_ip > > Despite the warning, the code itself can still work correctly, but IMO we'd > better switch back to local_irq_save/restore(), and hence I made the patch. > > I hope the explanation sounds reasonable. :-) Sorry for the delay in replying. I need to understand if you are preventing a spurious lockdep warning or you are fixing a kernel bug. From your commit log, I assume the former option but I do not think that's what you are really doing. Apart from the commit log typos fixes I would like a log that explains *why* this is not a kernel bug fix rather than a harmless lockdep warning prevention. Thanks, Lorenzo