Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751929AbdC0SNl (ORCPT ); Mon, 27 Mar 2017 14:13:41 -0400 Received: from mail-sn1nam01on0128.outbound.protection.outlook.com ([104.47.32.128]:48288 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751526AbdC0SNe (ORCPT ); Mon, 27 Mar 2017 14:13:34 -0400 From: Long Li To: KY Srinivasan , "helgaas@kernel.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "devel@linuxdriverproject.org" , "olaf@aepfle.de" , "apw@canonical.com" , "vkuznets@redhat.com" , "jasowang@redhat.com" , "leann.ogasawara@canonical.com" , "marcelo.cerri@canonical.com" , "Stephen Hemminger" CC: "stable@vger.kernel.org" Subject: RE: [PATCH 1/2] pci-hyperv: Fix a bug in specifying CPU affinity Thread-Topic: [PATCH 1/2] pci-hyperv: Fix a bug in specifying CPU affinity Thread-Index: AQHSpMmpWyczyHVQvUOd4JRnNPkBI6GpAZFA Date: Mon, 27 Mar 2017 18:13:30 +0000 Message-ID: References: <1490378800-26907-1-git-send-email-kys@exchange.microsoft.com> <1490378842-26950-2-git-send-email-kys@exchange.microsoft.com> In-Reply-To: <1490378842-26950-2-git-send-email-kys@exchange.microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: microsoft.com; dkim=none (message not signed) header.d=none;microsoft.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [2001:4898:80e8:9::735] x-microsoft-exchange-diagnostics: 1;SN1PR0301MB2110;7:W++PaOh2E8QH3kO5Ab1P+xWU258sNn/lbGbTsmXj5E0+KRlpbyKN/UN02KoEISEzThsY8oGEfpRl9P8hAB+5PgH+A3nfT7Ecy5e3s4/SeGRQffc4EQk1W3wbYMbd23lvmHWqGp6pESDR8XxK80IJgBtuyvlHq3FkiP2CuDemQm4f0iAlpJk8CaMSGYHB+38blkWNk8R4a4VAyjR/BOVqR9pVBe6nr6RfAtHJlE6DZAi9zYmMr65o9676XlgzZZtUpyXR4Wo2dPdxEiwJonAaZVkauQNsYEU/RUc0RCHxdDp3HOl8DaM6Nj+lQF3qXrS76Q1HEL4P1hPZjBda70PSct1iYQBUTxmv0TCe6b0CkvQ= x-ms-office365-filtering-correlation-id: 39f9fdd5-570c-493b-b25b-08d4753cf912 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001)(2017030254075)(48565401081)(201703131423048)(201703031133054)(201702281549048);SRVR:SN1PR0301MB2110; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(9452136761055)(140211028294663)(198206253151910); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(61425038)(6040423)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041248)(201703131423048)(201703011903048)(201702281528048)(201703061421048)(20161123560025)(20161123558025)(20161123555025)(20161123564025)(20161123562025)(6072148);SRVR:SN1PR0301MB2110;BCL:0;PCL:0;RULEID:;SRVR:SN1PR0301MB2110; x-forefront-prvs: 02596AB7DA x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(6009001)(39410400002)(39400400002)(39850400002)(39860400002)(39840400002)(39450400003)(377454003)(13464003)(33656002)(1720100001)(76176999)(6116002)(50986999)(54356999)(102836003)(86612001)(86362001)(2201001)(2900100001)(966004)(9686003)(53936002)(99286003)(305945005)(6306002)(74316002)(55016002)(7736002)(122556002)(5660300001)(7416002)(6506006)(6436002)(77096006)(7696004)(53546009)(3660700001)(3280700002)(25786009)(2950100002)(6636002)(2501003)(189998001)(6246003)(229853002)(38730400002)(4326008)(10090500001)(2906002)(10290500002)(8990500004)(81166006)(1511001)(8936002)(8676002)(5005710100001)(921003)(1121003);DIR:OUT;SFP:1102;SCL:1;SRVR:SN1PR0301MB2110;H:BN3PR03MB2227.namprd03.prod.outlook.com;FPR:;SPF:None;MLV:sfv;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: 27 Mar 2017 18:13:30.1720 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR0301MB2110 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 v2RIE6TN002905 Content-Length: 2537 Lines: 62 > -----Original Message----- > From: devel [mailto:driverdev-devel-bounces@linuxdriverproject.org] On > Behalf Of kys@exchange.microsoft.com > Sent: Friday, March 24, 2017 11:07 AM > To: helgaas@kernel.org; linux-pci@vger.kernel.org; linux- > kernel@vger.kernel.org; devel@linuxdriverproject.org; olaf@aepfle.de; > apw@canonical.com; vkuznets@redhat.com; jasowang@redhat.com; > leann.ogasawara@canonical.com; marcelo.cerri@canonical.com; Stephen > Hemminger > Cc: stable@vger.kernel.org > Subject: [PATCH 1/2] pci-hyperv: Fix a bug in specifying CPU affinity > > From: K. Y. Srinivasan > > When we have 32 or more CPUs in the affinity mask, we should use a special > constant to specify that to the host. Fix this issue. > > Signed-off-by: K. Y. Srinivasan > Cc: Reviewed-by: Long Li > --- > drivers/pci/host/pci-hyperv.c | 11 ++++++++--- > 1 files changed, 8 insertions(+), 3 deletions(-) > > diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c > index ada9856..32a16fb 100644 > --- a/drivers/pci/host/pci-hyperv.c > +++ b/drivers/pci/host/pci-hyperv.c > @@ -72,6 +72,7 @@ enum { > PCI_PROTOCOL_VERSION_CURRENT = PCI_PROTOCOL_VERSION_1_1 }; > > +#define CPU_AFFINITY_ALL -1ULL > #define PCI_CONFIG_MMIO_LENGTH 0x2000 > #define CFG_PAGE_OFFSET 0x1000 > #define CFG_PAGE_SIZE (PCI_CONFIG_MMIO_LENGTH - > CFG_PAGE_OFFSET) @@ -897,9 +898,13 @@ static void > hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) > * processors because Hyper-V only supports 64 in a guest. > */ > affinity = irq_data_get_affinity_mask(data); > - for_each_cpu_and(cpu, affinity, cpu_online_mask) { > - int_pkt->int_desc.cpu_mask |= > - (1ULL << vmbus_cpu_number_to_vp_number(cpu)); > + if (cpumask_weight(affinity) >= 32) { > + int_pkt->int_desc.cpu_mask = CPU_AFFINITY_ALL; > + } else { > + for_each_cpu_and(cpu, affinity, cpu_online_mask) { > + int_pkt->int_desc.cpu_mask |= > + (1ULL << vmbus_cpu_number_to_vp_number(cpu)); > + } > } > > ret = vmbus_sendpacket(hpdev->hbus->hdev->channel, int_pkt, > -- > 1.7.1 > > _______________________________________________ > devel mailing list > devel@linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel