Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1410484
| Path | csiph.com!news.freedyn.net!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Jake Oshins <jakeo@microsoft.com> |
| Newsgroups | linux.kernel |
| Subject | RE: [PATCH 2/2] PCI: hv: handle all pending messages in hv_pci_onchannelcallback() |
| Date | Tue, 31 May 2016 19:40:02 +0200 |
| Message-ID | <rEVO2-5FM-7@gated-at.bofh.it> (permalink) |
| References | <rEwcV-5hx-3@gated-at.bofh.it> <rEwcV-5hx-23@gated-at.bofh.it> |
| X-Original-To | Vitaly Kuznetsov <vkuznets@redhat.com>, "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=o4scLBZg3uBMbpRll1Y3aEckDuzOFrKbazyeflpclBE=; b=GiQm/qVWVLhaXYRI3/qAsJHcr9QKsnmVxmcR850m9asJsC5JlARXR0E7a7I1hZgv+TdnvZMOAzSsZRXSE8eP+na8SLmQKVkys17QjUt64ZcKFsvyUXHtZb5dl6qSLQ6fpfodJSQ6WJoORVqpl42469kwN0aZrEM2+mXPsZYhLpg= |
| Thread-Topic | [PATCH 2/2] PCI: hv: handle all pending messages in hv_pci_onchannelcallback() |
| Thread-Index | AQHRun4Yi2s1fk51t0O0oVHDduVOsp/TUI2Q |
| Accept-Language | en-US |
| Content-Language | en-US |
| Authentication-Results | redhat.com; dkim=none (message not signed) header.d=none;redhat.com; dmarc=none action=none header.from=microsoft.com; |
| X-Originating-IP | [2001:4898:80e8:9::563] |
| X-Ms-Office365-Filtering-Correlation-ID | 7b5c03a3-5de0-4460-544b-08d3897a1251 |
| X-Microsoft-Exchange-Diagnostics | 1;DM2PR0301MB0782;5:mEAHRRcZWPT2i+YGUp/xLMrXO0Z6Gk63tVb2NfZhuGDDQC5MD5CNCyXc5NHr4LzL4ktTDmhsx4LlcNzDWiDIsAdQpSh9cYJrye9hhL00+W2E0iLUmqXVRwLaaz4qtFimyrAxxvmpzNo+hIr5W443fQ==;24:4/zYG8aL0AV2U0DZ9S6kP3RXQEFvpDhOWt9zJzn22P1/jVPVr2xdpqCeGZUdxTGu88vx8LaB16nQwWqnP1hjYcPyooTY7hZO+OTr4rS/9m0=;7:XKBIZawlyHzR1jrL8Q+dvRgReBSz1cmFmJOcqlW0y8K7aGPCqnCZPq5ENvJ4Nbr4/yG/Tfkyq72SBDQ/HET2wf2I8bb1JBhsPyflU+QBXqCyuIHRFD8xJOmbqTzp+DhcVugroNBig0Mq0je3G5W4s97hS2tPr5e87mUPwtZkdlI= |
| X-Microsoft-Antispam | UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0782; |
| X-Microsoft-Antispam-Prvs | <DM2PR0301MB07820B4256670F736680BF10AB460@DM2PR0301MB0782.namprd03.prod.outlook.com> |
| X-Exchange-Antispam-Report-Test | UriScan:(9452136761055)(211936372134217); |
| X-Exchange-Antispam-Report-Cfa-Test | BCL:0;PCL:0;RULEID:(61425038)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(61426038)(61427038);SRVR:DM2PR0301MB0782;BCL:0;PCL:0;RULEID:;SRVR:DM2PR0301MB0782; |
| X-Forefront-Prvs | 095972DF2F |
| X-Forefront-Antispam-Report | SFV:NSPM;SFS:(10019020)(6009001)(377454003)(13464003)(19580405001)(107886002)(106116001)(99286002)(19580395003)(11100500001)(9686002)(5004730100002)(74316001)(189998001)(5001770100001)(5008740100001)(87936001)(33656002)(4001430100002)(10090500001)(76576001)(4326007)(5003600100002)(15650500001)(5002640100001)(5005710100001)(6116002)(77096005)(2950100001)(122556002)(2900100001)(3660700001)(86362001)(102836003)(2501003)(3280700002)(92566002)(76176999)(81166006)(8676002)(8936002)(8990500004)(54356999)(50986999)(10290500002)(586003)(10400500002)(2906002)(3826002);DIR:OUT;SFP:1102;SCL:1;SRVR:DM2PR0301MB0782;H:DM2PR0301MB1232.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;LANG:en; |
| Content-Type | text/plain; charset="us-ascii" |
| Content-Transfer-Encoding | 8BIT |
| MIME-Version | 1.0 |
| X-Originatororg | microsoft.com |
| X-Ms-Exchange-Crosstenant-Originalarrivaltime | 31 May 2016 17:36:17.3675 (UTC) |
| X-Ms-Exchange-Crosstenant-Fromentityheader | Hosted |
| X-Ms-Exchange-Crosstenant-ID | 72f988bf-86f1-41af-91ab-2d7cd011db47 |
| X-Ms-Exchange-Transport-Crosstenantheadersstamped | DM2PR0301MB0782 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 70 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "devel@linuxdriverproject.org" <devel@linuxdriverproject.org>, Bjorn Helgaas <bhelgaas@google.com>, Haiyang Zhang <haiyangz@microsoft.com>, KY Srinivasan <kys@microsoft.com> |
| X-Original-Date | Tue, 31 May 2016 17:36:17 +0000 |
| X-Original-Message-ID | <DM2PR0301MB12324110CE3406B0CD68F3EDAB460@DM2PR0301MB1232.namprd03.prod.outlook.com> |
| X-Original-References | <1464617879-19581-1-git-send-email-vkuznets@redhat.com> <1464617879-19581-3-git-send-email-vkuznets@redhat.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1410484 |
Show key headers only | View raw
> -----Original Message-----
> From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com]
> Sent: Monday, May 30, 2016 7:18 AM
> To: linux-pci@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org; devel@linuxdriverproject.org; Bjorn
> Helgaas <bhelgaas@google.com>; Haiyang Zhang
> <haiyangz@microsoft.com>; KY Srinivasan <kys@microsoft.com>; Jake
> Oshins <jakeo@microsoft.com>
> Subject: [PATCH 2/2] PCI: hv: handle all pending messages in
> hv_pci_onchannelcallback()
>
> When we have an interrupt from host we have a bit set in event page
> indicating there are messages for the particular channel. We need to read
> them all as we won't get signaled for what was on the queue before we
> cleared the bit in vmbus_on_event(). This applies to all Hyper-V drivers
> and the pass-through driver should do the same.
> I did non meet any bugs, the issue was found by code inspection. We don't
> have many events going through hv_pci_onchannelcallback(), this explains
> why nobody reported the issue before.
>
> While on it, fix handling non-zero vmbus_recvpacket_raw() return values by
> dropping out. If the return value is not zero it is wrong to inspect
> buffer or bytes_recvd as these may contain invalid data.
>
> Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Acked-by: Jake Oshins <jakeo@microsoft.com>
> ---
> drivers/pci/host/pci-hyperv.c | 7 +++++--
> 1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
> index a68ec49..7de341d 100644
> --- a/drivers/pci/host/pci-hyperv.c
> +++ b/drivers/pci/host/pci-hyperv.c
> @@ -1657,12 +1657,16 @@ static void hv_pci_onchannelcallback(void
> *context)
> continue;
> }
>
> + /* Zero length indicates there are no more packets. */
> + if (ret || !bytes_recvd)
> + break;
> +
> /*
> * All incoming packets must be at least as large as a
> * response.
> */
> if (bytes_recvd <= sizeof(struct pci_response))
> - break;
> + continue;
> desc = (struct vmpacket_descriptor *)buffer;
>
> switch (desc->type) {
> @@ -1724,7 +1728,6 @@ static void hv_pci_onchannelcallback(void
> *context)
> desc->type, req_id, bytes_recvd);
> break;
> }
> - break;
> }
>
> kfree(buffer);
> --
> 2.5.5
This is good, too.
Thanks,
Jake Oshins
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/2] PCI: hv: fix a couple of issues in hv_pci_onchannelcallback() Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-05-30 16:20 +0200
[PATCH 2/2] PCI: hv: handle all pending messages in hv_pci_onchannelcallback() Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-05-30 16:20 +0200
RE: [PATCH 2/2] PCI: hv: handle all pending messages in hv_pci_onchannelcallback() Jake Oshins <jakeo@microsoft.com> - 2016-05-31 19:40 +0200
[PATCH 1/2] PCI: hv: don't leak buffer in hv_pci_onchannelcallback() Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-05-30 16:20 +0200
RE: [PATCH 1/2] PCI: hv: don't leak buffer in hv_pci_onchannelcallback() Jake Oshins <jakeo@microsoft.com> - 2016-05-31 20:10 +0200
Re: [PATCH 0/2] PCI: hv: fix a couple of issues in hv_pci_onchannelcallback() Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-06-10 14:10 +0200
Re: [PATCH 0/2] PCI: hv: fix a couple of issues in hv_pci_onchannelcallback() Bjorn Helgaas <helgaas@kernel.org> - 2016-06-10 17:40 +0200
Re: [PATCH 0/2] PCI: hv: fix a couple of issues in hv_pci_onchannelcallback() Bjorn Helgaas <helgaas@kernel.org> - 2016-06-11 02:00 +0200
csiph-web