From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965930AbcKJUC0 (ORCPT ); Thu, 10 Nov 2016 15:02:26 -0500 Received: from mail-dm3nam03on0134.outbound.protection.outlook.com ([104.47.41.134]:15925 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965893AbcKJUCY (ORCPT ); Thu, 10 Nov 2016 15:02:24 -0500 X-Greylist: delayed 10832 seconds by postgrey-1.27 at vger.kernel.org; Thu, 10 Nov 2016 15:02:23 EST From: Jake Oshins To: Dexuan Cui , Bjorn Helgaas , "linux-pci@vger.kernel.org" , "devel@linuxdriverproject.org" CC: "gregkh@linuxfoundation.org" , KY Srinivasan , Haiyang Zhang , "Stephen Hemminger" , Hadden Hoppert , Vitaly Kuznetsov , "jasowang@redhat.com" , "apw@canonical.com" , "olaf@aepfle.de" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH 1/3] PCI: hv: use the correct buffer size in new_pcichild_device() Thread-Topic: [PATCH 1/3] PCI: hv: use the correct buffer size in new_pcichild_device() Thread-Index: AdI7IoRA7oW02ygCRFeoAZworZG8EQATEeQw Date: Thu, 10 Nov 2016 16:27:17 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=jakeo@microsoft.com; x-originating-ip: [166.255.17.16] x-microsoft-exchange-diagnostics: 1;BLUPR0301MB2099;7:vP2qzB4RpVAGS0mAfO60jMhw4uQyLV94/rSD6czgYP6mi+uSYaiAzq/G02hKu+13cDbfoC20RX8FBKSZFSqZQRVzUrkHslTjNSMB8RMVKViQn9G82viTx3ZLF6WabZAQO/+nwmqmS23iQOZoUbuTIRR5BYMGI5T0Te9avBOc7PLGfQRnaqfk653+xbCF6nU6ah0EaNb8YyMw/N5xL5VZo4IqkBoOyCdSb/T/i1Wa4cVunD6G+DcOQf8cob5hlt91vE58fATT8voEeH9yaLHbqIG1av9NW685gj0mYKW7tyuvDTc1FkqSnr/qPfQCawhKuugVipWX/Z9YLZbyy126lzQd7E1mp6fnNx6WrUVBSOIS2KOkNbRNXP5JCxf/juof x-ms-office365-filtering-correlation-id: 807a7ee5-2ee8-4b96-7ae6-08d40986701d x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:BLUPR0301MB2099; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(211936372134217)(198206253151910); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6045074)(6060229)(6040176)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(61426038)(61427038)(6061226)(6046074);SRVR:BLUPR0301MB2099;BCL:0;PCL:0;RULEID:;SRVR:BLUPR0301MB2099; x-forefront-prvs: 01221E3973 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(7916002)(189002)(199003)(13464003)(377454003)(77096005)(4326007)(106356001)(5660300001)(2900100001)(87936001)(3280700002)(7846002)(2950100002)(7736002)(3900700001)(10290500002)(5005710100001)(305945005)(86612001)(54356999)(2201001)(92566002)(66066001)(105586002)(99286002)(76576001)(3660700001)(86362001)(76176999)(74316002)(189998001)(2906002)(2501003)(50986999)(2421001)(101416001)(8990500004)(5001770100001)(122556002)(7696004)(97736004)(8936002)(8676002)(81166006)(81156014)(33656002)(10090500001)(68736007)(1511001)(102836003)(9686002)(586003)(229853002)(3846002)(2561002)(6116002);DIR:OUT;SFP:1102;SCL:1;SRVR:BLUPR0301MB2099;H:BLUPR0301MB1587.namprd03.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-originalarrivaltime: 10 Nov 2016 16:27:17.5188 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR0301MB2099 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id uAAK2U9r026258 > -----Original Message----- > From: Dexuan Cui > Sent: Wednesday, November 9, 2016 11:18 PM > To: Bjorn Helgaas ; linux-pci@vger.kernel.org; > devel@linuxdriverproject.org > Cc: gregkh@linuxfoundation.org; KY Srinivasan ; > Haiyang Zhang ; Stephen Hemminger > ; Jake Oshins ; Hadden > Hoppert ; Vitaly Kuznetsov > ; jasowang@redhat.com; apw@canonical.com; > olaf@aepfle.de; linux-kernel@vger.kernel.org > Subject: [PATCH 1/3] PCI: hv: use the correct buffer size in > new_pcichild_device() > > We don't really need such a big on-stack buffer. > vmbus_sendpacket() here only uses sizeof(struct pci_child_message). > > Signed-off-by: Dexuan Cui > CC: Jake Oshins > Cc: KY Srinivasan > CC: Haiyang Zhang > CC: Vitaly Kuznetsov > --- > drivers/pci/host/pci-hyperv.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c > index 763ff87..93ed64a 100644 > --- a/drivers/pci/host/pci-hyperv.c > +++ b/drivers/pci/host/pci-hyperv.c > @@ -1271,9 +1271,9 @@ static struct hv_pci_dev > *new_pcichild_device(struct hv_pcibus_device *hbus, > struct hv_pci_dev *hpdev; > struct pci_child_message *res_req; > struct q_res_req_compl comp_pkt; > - union { > - struct pci_packet init_packet; > - u8 buffer[0x100]; > + struct { > + struct pci_packet init_packet; > + u8 buffer[sizeof(struct pci_child_message)]; > } pkt; > unsigned long flags; > int ret; > -- > 2.7.4 This change seems good to me, in that it's always a bad idea to use too much stack. But this won't fix the problem with VMAP_STACK. The buffer could still end up spanning two pages and the physical addresses of those pages would possibly be discontiguous. Do you want to just refactor this so that it uses a fixed buffer, one that will work with VMAP_STACK? Or is that coming in a future patch? -- Jake Oshins