[4.2.y-ckt stable] Patch "cxl: Fix number of allocated pages in SPA" has been added to staging queue

Kamal Mostafa kamal at canonical.com
Mon Jan 4 23:20:39 UTC 2016


This is a note to let you know that I have just added a patch titled

    cxl: Fix number of allocated pages in SPA

to the linux-4.2.y-queue branch of the 4.2.y-ckt extended stable tree 
which can be found at:

    http://kernel.ubuntu.com/git/ubuntu/linux.git/log/?h=linux-4.2.y-queue

This patch is scheduled to be released in version 4.2.8-ckt1.

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 4.2.y-ckt tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Kamal

------

>From 32190d02dbe6a68dd2ffe6d8ee0a71546f92e7fb Mon Sep 17 00:00:00 2001
From: Christophe Lombard <clombard at linux.vnet.ibm.com>
Date: Wed, 7 Oct 2015 16:07:40 +1100
Subject: cxl: Fix number of allocated pages in SPA

commit 4108efb02daa09cbb5db048ada55a5b021b5183d upstream.

The scheduled process area is currently allocated before assigning the
correct maximum processes to the AFU, which will mean we only ever
allocate a fixed number of pages for the scheduled process area. This
will limit us to 958 processes with 2 x 64K pages. If we try to use more
processes than that we'd probably overrun the buffer and corrupt memory
or crash.

AFUs that require three or more interrupts per process will not be
affected as they are already limited to less processes than that, but we
could hit it on an AFU that requires 0, 1 or 2 interrupts per process,
or when using 4K pages.

This patch moves the initialisation of the num_procs to before the SPA
allocation so that enough pages will be allocated for the number of
processes that the AFU supports.

Signed-off-by: Christophe Lombard <clombard at linux.vnet.ibm.com>
Signed-off-by: Ian Munsie <imunsie at au1.ibm.com>
Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>
[ kamal: backport to 4.2-stable: context ]
Signed-off-by: Kamal Mostafa <kamal at canonical.com>
---
 drivers/misc/cxl/native.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/cxl/native.c b/drivers/misc/cxl/native.c
index 10567f2..8339eb2 100644
--- a/drivers/misc/cxl/native.c
+++ b/drivers/misc/cxl/native.c
@@ -397,6 +397,7 @@ static int activate_afu_directed(struct cxl_afu *afu)

 	dev_info(&afu->dev, "Activating AFU directed mode\n");

+	afu->num_procs = afu->max_procs_virtualised;
 	if (alloc_spa(afu))
 		return -ENOMEM;

@@ -405,7 +406,6 @@ static int activate_afu_directed(struct cxl_afu *afu)
 	cxl_p1n_write(afu, CXL_PSL_ID_An, CXL_PSL_ID_An_F | CXL_PSL_ID_An_L);

 	afu->current_mode = CXL_MODE_DIRECTED;
-	afu->num_procs = afu->max_procs_virtualised;

 	if ((rc = cxl_chardev_m_afu_add(afu)))
 		return rc;
--
1.9.1





More information about the kernel-team mailing list