Patch "PCI: hv: Reuse existing IRTE allocation in compose_msi_msg()" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    PCI: hv: Reuse existing IRTE allocation in compose_msi_msg()

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     pci-hv-reuse-existing-irte-allocation-in-compose_msi_msg.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.


>From foo@baz Wed Jul 27 12:32:32 PM CEST 2022
From: Carl Vanderlip <quic_carlv@xxxxxxxxxxx>
Date: Mon, 25 Jul 2022 16:32:39 +0000
Subject: PCI: hv: Reuse existing IRTE allocation in compose_msi_msg()
To: <stable@xxxxxxxxxxxxxxx>
Cc: Jeffrey Hugo <quic_jhugo@xxxxxxxxxxx>, <kys@xxxxxxxxxxxxx>, <haiyangz@xxxxxxxxxxxxx>, <sthemmin@xxxxxxxxxxxxx>, <wei.liu@xxxxxxxxxxxxx>, <decui@xxxxxxxxxxxxx>, <lorenzo.pieralisi@xxxxxxx>, <robh@xxxxxxxxxx>, <kw@xxxxxxxxx>, <bhelgaas@xxxxxxxxxx>, Michael Kelley <mikelley@xxxxxxxxxxxxx>, Wei Liu <wei.liu@xxxxxxxxxx>, Carl Vanderlip <quic_carlv@xxxxxxxxxxx>
Message-ID: <20220725163240.13001-4-quic_carlv@xxxxxxxxxxx>

From: Jeffrey Hugo <quic_jhugo@xxxxxxxxxxx>

commit b4b77778ecc5bfbd4e77de1b2fd5c1dd3c655f1f upstream.

Currently if compose_msi_msg() is called multiple times, it will free any
previous IRTE allocation, and generate a new allocation.  While nothing
prevents this from occurring, it is extraneous when Linux could just reuse
the existing allocation and avoid a bunch of overhead.

However, when future IRTE allocations operate on blocks of MSIs instead of
a single line, freeing the allocation will impact all of the lines.  This
could cause an issue where an allocation of N MSIs occurs, then some of
the lines are retargeted, and finally the allocation is freed/reallocated.
The freeing of the allocation removes all of the configuration for the
entire block, which requires all the lines to be retargeted, which might
not happen since some lines might already be unmasked/active.

Signed-off-by: Jeffrey Hugo <quic_jhugo@xxxxxxxxxxx>
Reviewed-by: Dexuan Cui <decui@xxxxxxxxxxxxx>
Tested-by: Dexuan Cui <decui@xxxxxxxxxxxxx>
Tested-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>
Link: https://lore.kernel.org/r/1652282582-21595-1-git-send-email-quic_jhugo@xxxxxxxxxxx
Signed-off-by: Wei Liu <wei.liu@xxxxxxxxxx>
Signed-off-by: Carl Vanderlip <quic_carlv@xxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
 drivers/pci/controller/pci-hyperv.c |   16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

--- a/drivers/pci/controller/pci-hyperv.c
+++ b/drivers/pci/controller/pci-hyperv.c
@@ -1109,6 +1109,15 @@ static void hv_compose_msi_msg(struct ir
 	u32 size;
 	int ret;
 
+	/* Reuse the previous allocation */
+	if (data->chip_data) {
+		int_desc = data->chip_data;
+		msg->address_hi = int_desc->address >> 32;
+		msg->address_lo = int_desc->address & 0xffffffff;
+		msg->data = int_desc->data;
+		return;
+	}
+
 	pdev = msi_desc_to_pci_dev(irq_data_get_msi_desc(data));
 	dest = irq_data_get_effective_affinity_mask(data);
 	pbus = pdev->bus;
@@ -1117,13 +1126,6 @@ static void hv_compose_msi_msg(struct ir
 	if (!hpdev)
 		goto return_null_message;
 
-	/* Free any previous message that might have already been composed. */
-	if (data->chip_data) {
-		int_desc = data->chip_data;
-		data->chip_data = NULL;
-		hv_int_desc_free(hpdev, int_desc);
-	}
-
 	int_desc = kzalloc(sizeof(*int_desc), GFP_ATOMIC);
 	if (!int_desc)
 		goto drop_reference;


Patches currently in stable-queue which might be from quic_carlv@xxxxxxxxxxx are

queue-4.19/pci-hv-fix-interrupt-mapping-for-multi-msi.patch
queue-4.19/pci-hv-fix-multi-msi-to-allow-more-than-one-msi-vector.patch
queue-4.19/pci-hv-reuse-existing-irte-allocation-in-compose_msi_msg.patch
queue-4.19/pci-hv-fix-hv_arch_irq_unmask-for-multi-msi.patch



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux