From patchwork Fri Mar 24 18:07:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: kys@exchange.microsoft.com X-Patchwork-Id: 9643661 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1DC3E60327 for ; Fri, 24 Mar 2017 18:21:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 146522654B for ; Fri, 24 Mar 2017 18:21:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 08D1526CF9; Fri, 24 Mar 2017 18:21:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABDA12654B for ; Fri, 24 Mar 2017 18:21:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934758AbdCXSTx (ORCPT ); Fri, 24 Mar 2017 14:19:53 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:44100 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933609AbdCXSTu (ORCPT ); Fri, 24 Mar 2017 14:19:50 -0400 Received: from linuxonhyperv.com ([107.180.71.197]) by : HOSTING RELAY : with SMTP id rTcSceIN8CQzGrTcScHak8; Fri, 24 Mar 2017 11:07:24 -0700 x-originating-ip: 107.180.71.197 Received: from kys by linuxonhyperv.com with local (Exim 4.88) (envelope-from ) id 1crTcR-00071M-VR; Fri, 24 Mar 2017 11:07:24 -0700 From: kys@exchange.microsoft.com 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, sthemmin@microsoft.com Cc: "K. Y. Srinivasan" , Subject: [PATCH 1/2] pci-hyperv: Fix a bug in specifying CPU affinity Date: Fri, 24 Mar 2017 11:07:21 -0700 Message-Id: <1490378842-26950-2-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1490378800-26907-1-git-send-email-kys@exchange.microsoft.com> References: <1490378800-26907-1-git-send-email-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfBbTgKKKeGdLP1EuUTRUVSaBlCI92FPNbnznR1w2aQGL3t1khCszFZfTZ2COKdlRhomBeq7FGOA6u1jfMOTO9GpA+Qq0gWYZb5Z+YrJiP9/k57TvFR0/ 3s0KApj+HzwOfTsCd02mtF3YKFRVeWVy8l7zwBQZPtGsdGywo21QjD5cBGkQBMuXzRm7PHt9PKbKoG+Ooam5zFy9hDBLOiF7W9hR5zUIJ5lBsqR92QIDN8Fl Ng+2J86XNIROkrPudJhgafwOlG5AN7wUGaq2M6S1mlzc6SLXO13pM4JH7QWCeqzg+Bfwwxu8x6/LcC2xTVPYywdWjc0WBsmcn3UCLRvvas6xzIFx+nUOMjEj cGc7fCYxqAv5lnsJOCCyUT5YF1ZlZ47D4KxPvudyNOlrXomCm0zc8l+/LFfGL79CV0iJTS/7qmEn2ux3AJTnTRTogKxOLQTsWs0qz1VTaiegTwWZ9rlNsoHx hEbJhHRGBsE+P+uqWKlkulGYRggyR2aqtvnKBPwW7eAPEnol2Uu1qIISC/hHAF6yiUZZDJCEE1jATxGv/9ymPbSUI5BpzVReNGu7TJcr/HVMbFeLYoVrqf/C /iY= Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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,