2017-03-24 18:09:09

by kys

[permalink] [raw]
Subject: [PATCH 0/2] pci-hyperv: Some miscellaneous fixes

From: K. Y. Srinivasan <[email protected]>

Some miscellaneous fixes.

K. Y. Srinivasan (2):
pci-hyperv: Fix a bug in specifying CPU affinity
pci-hyperv: Fix an atomic bug

drivers/pci/host/pci-hyperv.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)


2017-03-24 18:08:46

by kys

[permalink] [raw]
Subject: [PATCH 2/2] pci-hyperv: Fix an atomic bug

From: K. Y. Srinivasan <[email protected]>

The memory allocation here needs to be non-blocking.
Fix the issue.

Signed-off-by: K. Y. Srinivasan <[email protected]>
Cc: <[email protected]>
---
drivers/pci/host/pci-hyperv.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index 32a16fb..85088a1 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -877,7 +877,7 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg)
hv_int_desc_free(hpdev, int_desc);
}

- int_desc = kzalloc(sizeof(*int_desc), GFP_KERNEL);
+ int_desc = kzalloc(sizeof(*int_desc), GFP_ATOMIC);
if (!int_desc)
goto drop_reference;

--
1.7.1

2017-03-24 18:08:58

by kys

[permalink] [raw]
Subject: [PATCH 1/2] pci-hyperv: Fix a bug in specifying CPU affinity

From: K. Y. Srinivasan <[email protected]>

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 <[email protected]>
Cc: <[email protected]>
---
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

2017-03-24 18:10:47

by kys

[permalink] [raw]
Subject: [PATCH 1/2] PCI: hv: Fix a bug in specifying CPU affinity

From: K. Y. Srinivasan <[email protected]>

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 <[email protected]>
Cc: <[email protected]>
---
drivers/pci/host/pci-hyperv.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
index ada9856..2c2ea1e 100644
--- a/drivers/pci/host/pci-hyperv.c
+++ b/drivers/pci/host/pci-hyperv.c
@@ -897,9 +897,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 = -1ULL;
+ } 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

2017-03-27 18:13:41

by Long Li

[permalink] [raw]
Subject: RE: [PATCH 1/2] pci-hyperv: Fix a bug in specifying CPU affinity

> -----Original Message-----
> From: devel [mailto:[email protected]] On
> Behalf Of [email protected]
> Sent: Friday, March 24, 2017 11:07 AM
> To: [email protected]; [email protected]; linux-
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; Stephen
> Hemminger <[email protected]>
> Cc: [email protected]
> Subject: [PATCH 1/2] pci-hyperv: Fix a bug in specifying CPU affinity
>
> From: K. Y. Srinivasan <[email protected]>
>
> 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 <[email protected]>
> Cc: <[email protected]>

Reviewed-by: Long Li <[email protected]>

> ---
> 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
> [email protected]
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

2017-03-27 18:14:31

by Long Li

[permalink] [raw]
Subject: RE: [PATCH 2/2] pci-hyperv: Fix an atomic bug

> -----Original Message-----
> From: devel [mailto:[email protected]] On
> Behalf Of [email protected]
> Sent: Friday, March 24, 2017 11:07 AM
> To: [email protected]; [email protected]; linux-
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected]; Stephen
> Hemminger <[email protected]>
> Cc: [email protected]
> Subject: [PATCH 2/2] pci-hyperv: Fix an atomic bug
>
> From: K. Y. Srinivasan <[email protected]>
>
> The memory allocation here needs to be non-blocking.
> Fix the issue.
>
> Signed-off-by: K. Y. Srinivasan <[email protected]>
> Cc: <[email protected]>

Reviewed-by: Long Li <[email protected]>

> ---
> drivers/pci/host/pci-hyperv.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c
> index 32a16fb..85088a1 100644
> --- a/drivers/pci/host/pci-hyperv.c
> +++ b/drivers/pci/host/pci-hyperv.c
> @@ -877,7 +877,7 @@ static void hv_compose_msi_msg(struct irq_data
> *data, struct msi_msg *msg)
> hv_int_desc_free(hpdev, int_desc);
> }
>
> - int_desc = kzalloc(sizeof(*int_desc), GFP_KERNEL);
> + int_desc = kzalloc(sizeof(*int_desc), GFP_ATOMIC);
> if (!int_desc)
> goto drop_reference;
>
> --
> 1.7.1
>
> _______________________________________________
> devel mailing list
> [email protected]
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

2017-04-04 19:03:37

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH 0/2] pci-hyperv: Some miscellaneous fixes

On Fri, Mar 24, 2017 at 11:06:40AM -0700, [email protected] wrote:
> From: K. Y. Srinivasan <[email protected]>
>
> Some miscellaneous fixes.
>
> K. Y. Srinivasan (2):
> pci-hyperv: Fix a bug in specifying CPU affinity
> pci-hyperv: Fix an atomic bug
>
> drivers/pci/host/pci-hyperv.c | 13 +++++++++----
> 1 files changed, 9 insertions(+), 4 deletions(-)

I applied these with Long's reviewed-by to pci/host-hv for v4.12 with the
following subject lines:

PCI: hv: Specify CPU_AFFINITY_ALL for MSI affinity when >= 32 CPUs
PCI: hv: Allocate interrupt descriptors with GFP_ATOMIC

There were two copies of [1/2], which makes this error-prone. I applied
the second one that defines CPU_AFFINITY_ALL.

They're both marked for stable, but without any clue about when the
problems were introduced or how serious they are, I did not queue them for
v4.11. If you want them in v4.11, please supply those additional details.

Bjorn

2017-04-04 19:54:37

by KY Srinivasan

[permalink] [raw]
Subject: RE: [PATCH 0/2] pci-hyperv: Some miscellaneous fixes



> -----Original Message-----
> From: Bjorn Helgaas [mailto:[email protected]]
> Sent: Tuesday, April 4, 2017 12:04 PM
> To: KY Srinivasan <[email protected]>
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; Stephen
> Hemminger <[email protected]>
> Subject: Re: [PATCH 0/2] pci-hyperv: Some miscellaneous fixes
>
> On Fri, Mar 24, 2017 at 11:06:40AM -0700, [email protected]
> wrote:
> > From: K. Y. Srinivasan <[email protected]>
> >
> > Some miscellaneous fixes.
> >
> > K. Y. Srinivasan (2):
> > pci-hyperv: Fix a bug in specifying CPU affinity
> > pci-hyperv: Fix an atomic bug
> >
> > drivers/pci/host/pci-hyperv.c | 13 +++++++++----
> > 1 files changed, 9 insertions(+), 4 deletions(-)
>
> I applied these with Long's reviewed-by to pci/host-hv for v4.12 with the
> following subject lines:
>
> PCI: hv: Specify CPU_AFFINITY_ALL for MSI affinity when >= 32 CPUs
> PCI: hv: Allocate interrupt descriptors with GFP_ATOMIC
>
Thank you.

> There were two copies of [1/2], which makes this error-prone. I applied
> the second one that defines CPU_AFFINITY_ALL.

Thanks again; sorry for the confusion.

>
> They're both marked for stable, but without any clue about when the
> problems were introduced or how serious they are, I did not queue them for
> v4.11. If you want them in v4.11, please supply those additional details.

I think these issues have been there since the driver got merged upstream.
I would want this to be applied against 4.11 as well. Let me know if I should resend
these patches.

Thanks,

K. Y
>
> Bjorn

2017-04-04 20:39:39

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH 0/2] pci-hyperv: Some miscellaneous fixes

On Tue, Apr 04, 2017 at 07:54:33PM +0000, KY Srinivasan wrote:
> > -----Original Message-----
> > From: Bjorn Helgaas [mailto:[email protected]]
> > Sent: Tuesday, April 4, 2017 12:04 PM
> > To: KY Srinivasan <[email protected]>
> > Cc: [email protected]; [email protected];
> > [email protected]; [email protected]; [email protected];
> > [email protected]; [email protected];
> > [email protected]; [email protected]; Stephen
> > Hemminger <[email protected]>
> > Subject: Re: [PATCH 0/2] pci-hyperv: Some miscellaneous fixes
> >
> > On Fri, Mar 24, 2017 at 11:06:40AM -0700, [email protected]
> > wrote:
> > > From: K. Y. Srinivasan <[email protected]>
> > >
> > > Some miscellaneous fixes.
> > >
> > > K. Y. Srinivasan (2):
> > > pci-hyperv: Fix a bug in specifying CPU affinity
> > > pci-hyperv: Fix an atomic bug
> > >
> > > drivers/pci/host/pci-hyperv.c | 13 +++++++++----
> > > 1 files changed, 9 insertions(+), 4 deletions(-)
> >
> > I applied these with Long's reviewed-by to pci/host-hv for v4.12 with the
> > following subject lines:
> >
> > PCI: hv: Specify CPU_AFFINITY_ALL for MSI affinity when >= 32 CPUs
> > PCI: hv: Allocate interrupt descriptors with GFP_ATOMIC
> >
> Thank you.
>
> > There were two copies of [1/2], which makes this error-prone. I applied
> > the second one that defines CPU_AFFINITY_ALL.
>
> Thanks again; sorry for the confusion.
>
> >
> > They're both marked for stable, but without any clue about when the
> > problems were introduced or how serious they are, I did not queue them for
> > v4.11. If you want them in v4.11, please supply those additional details.
>
> I think these issues have been there since the driver got merged upstream.
> I would want this to be applied against 4.11 as well. Let me know if I should resend
> these patches.

No need to resend, but I do need more details about what issues these fix
and why they're more urgent than garden-variety bug fixes that are planned
for v4.12. In general for-linus is for fixing problems we added during the
merge window, or other high-priority, low-risk changes.

Bjorn

2017-04-04 21:47:55

by KY Srinivasan

[permalink] [raw]
Subject: RE: [PATCH 0/2] pci-hyperv: Some miscellaneous fixes



> -----Original Message-----
> From: Bjorn Helgaas [mailto:[email protected]]
> Sent: Tuesday, April 4, 2017 1:39 PM
> To: KY Srinivasan <[email protected]>
> Cc: [email protected]; [email protected];
> [email protected]; [email protected]; [email protected];
> [email protected]; [email protected];
> [email protected]; [email protected]; Stephen
> Hemminger <[email protected]>
> Subject: Re: [PATCH 0/2] pci-hyperv: Some miscellaneous fixes
>
> On Tue, Apr 04, 2017 at 07:54:33PM +0000, KY Srinivasan wrote:
> > > -----Original Message-----
> > > From: Bjorn Helgaas [mailto:[email protected]]
> > > Sent: Tuesday, April 4, 2017 12:04 PM
> > > To: KY Srinivasan <[email protected]>
> > > Cc: [email protected]; [email protected];
> > > [email protected]; [email protected]; [email protected];
> > > [email protected]; [email protected];
> > > [email protected]; [email protected]; Stephen
> > > Hemminger <[email protected]>
> > > Subject: Re: [PATCH 0/2] pci-hyperv: Some miscellaneous fixes
> > >
> > > On Fri, Mar 24, 2017 at 11:06:40AM -0700, [email protected]
> > > wrote:
> > > > From: K. Y. Srinivasan <[email protected]>
> > > >
> > > > Some miscellaneous fixes.
> > > >
> > > > K. Y. Srinivasan (2):
> > > > pci-hyperv: Fix a bug in specifying CPU affinity
> > > > pci-hyperv: Fix an atomic bug
> > > >
> > > > drivers/pci/host/pci-hyperv.c | 13 +++++++++----
> > > > 1 files changed, 9 insertions(+), 4 deletions(-)
> > >
> > > I applied these with Long's reviewed-by to pci/host-hv for v4.12 with the
> > > following subject lines:
> > >
> > > PCI: hv: Specify CPU_AFFINITY_ALL for MSI affinity when >= 32 CPUs
> > > PCI: hv: Allocate interrupt descriptors with GFP_ATOMIC
> > >
> > Thank you.
> >
> > > There were two copies of [1/2], which makes this error-prone. I applied
> > > the second one that defines CPU_AFFINITY_ALL.
> >
> > Thanks again; sorry for the confusion.
> >
> > >
> > > They're both marked for stable, but without any clue about when the
> > > problems were introduced or how serious they are, I did not queue them
> for
> > > v4.11. If you want them in v4.11, please supply those additional details.
> >
> > I think these issues have been there since the driver got merged
> upstream.
> > I would want this to be applied against 4.11 as well. Let me know if I should
> resend
> > these patches.
>
> No need to resend, but I do need more details about what issues these fix
> and why they're more urgent than garden-variety bug fixes that are planned
> for v4.12. In general for-linus is for fixing problems we added during the
> merge window, or other high-priority, low-risk changes.

For sure I want to get this into 4.12. Since it fixes issues that have been there for a long time,
(including 4.11), it would be good to get it into 4.11 as well.

Regards,

K. Y
>
> Bjorn