[ofa-general] [PATCH ofed-1.2.c] ehca: backport kmem_cache_zalloc() for 2.6.10/sles10/sles10_sp1
Hoang-Nam Nguyen
hnguyen at linux.vnet.ibm.com
Mon Aug 6 07:23:46 PDT 2007
Hello Michael and Vladimir!
This patch below adds a backport patch for ehca to the dirs 2.6.16, 2.6.16_sles10
and 2.6.16_sles10_sp1 underneath kernel_patches/backport of ofed-1.2.c source tree.
Thanks!
Nam
backport kmem_cache_zalloc() to 2.6.10, 2.6.10_sles10 and 2.6.10_sles10_sp1
Signed-off-by: Hoang-Nam Nguyen <hnguyen at de.ibm.com>
---
2.6.16/ehca_kmem_cache_zalloc_to_2_6_16.patch | 97 +++++++++++++++
2.6.16_sles10/ehca_kmem_cache_zalloc_to_2_6_16.patch | 97 +++++++++++++++
2.6.16_sles10_sp1/ehca_kmem_cache_zalloc_to_2_6_16.patch | 97 +++++++++++++++
3 files changed, 291 insertions(+)
diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/kernel_patches/backport/2.6.16/ehca_kmem_cache_zalloc_to_2_6_16.patch ofa_1_2_c_kernel-20070804-0200/kernel_patches/backport/2.6.16/ehca_kmem_cache_zalloc_to_2_6_16.patch
--- ofa_1_2_c_kernel-20070804-0200_orig/kernel_patches/backport/2.6.16/ehca_kmem_cache_zalloc_to_2_6_16.patch 1970-01-01 01:00:00.000000000 +0100
+++ ofa_1_2_c_kernel-20070804-0200/kernel_patches/backport/2.6.16/ehca_kmem_cache_zalloc_to_2_6_16.patch 2007-08-06 00:53:59.000000000 +0200
@@ -0,0 +1,97 @@
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_cq.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_cq.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_cq.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_cq.c 2007-08-06 00:41:50.000000000 +0200
+@@ -134,13 +134,14 @@ struct ib_cq *ehca_create_cq(struct ib_d
+ if (cqe >= 0xFFFFFFFF - 64 - additional_cqe)
+ return ERR_PTR(-EINVAL);
+
+- my_cq = kmem_cache_zalloc(cq_cache, GFP_KERNEL);
++ my_cq = kmem_cache_alloc(cq_cache, GFP_KERNEL);
+ if (!my_cq) {
+ ehca_err(device, "Out of memory for ehca_cq struct device=%p",
+ device);
+ return ERR_PTR(-ENOMEM);
+ }
+
++ memset(my_cq, 0, sizeof(*my_cq));
+ memset(¶m, 0, sizeof(struct ehca_alloc_cq_parms));
+
+ spin_lock_init(&my_cq->spinlock);
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_main.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_main.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_main.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_main.c 2007-08-06 00:40:58.000000000 +0200
+@@ -113,9 +113,11 @@ static struct kmem_cache *ctblk_cache =
+
+ void *ehca_alloc_fw_ctrlblock(gfp_t flags)
+ {
+- void *ret = kmem_cache_zalloc(ctblk_cache, flags);
++ void *ret = kmem_cache_alloc(ctblk_cache, flags);
+ if (!ret)
+ ehca_gen_err("Out of memory for ctblk");
++ else
++ memset(ret, 0, EHCA_PAGESIZE);
+ return ret;
+ }
+
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_mrmw.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_mrmw.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_mrmw.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_mrmw.c 2007-08-06 00:39:30.000000000 +0200
+@@ -55,8 +55,9 @@ static struct ehca_mr *ehca_mr_new(void)
+ {
+ struct ehca_mr *me;
+
+- me = kmem_cache_zalloc(mr_cache, GFP_KERNEL);
++ me = kmem_cache_alloc(mr_cache, GFP_KERNEL);
+ if (me) {
++ memset(me, 0, sizeof(*me));
+ spin_lock_init(&me->mrlock);
+ } else
+ ehca_gen_err("alloc failed");
+@@ -73,8 +74,9 @@ static struct ehca_mw *ehca_mw_new(void)
+ {
+ struct ehca_mw *me;
+
+- me = kmem_cache_zalloc(mw_cache, GFP_KERNEL);
++ me = kmem_cache_alloc(mw_cache, GFP_KERNEL);
+ if (me) {
++ memset(me, 0, sizeof(*me));
+ spin_lock_init(&me->mwlock);
+ } else
+ ehca_gen_err("alloc failed");
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_pd.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_pd.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_pd.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_pd.c 2007-08-06 00:38:14.000000000 +0200
+@@ -50,13 +50,14 @@ struct ib_pd *ehca_alloc_pd(struct ib_de
+ {
+ struct ehca_pd *pd;
+
+- pd = kmem_cache_zalloc(pd_cache, GFP_KERNEL);
++ pd = kmem_cache_alloc(pd_cache, GFP_KERNEL);
+ if (!pd) {
+ ehca_err(device, "device=%p context=%p out of memory",
+ device, context);
+ return ERR_PTR(-ENOMEM);
+ }
+
++ memset(pd, 0, sizeof(*pd));
+ pd->ownpid = current->tgid;
+
+ /*
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_qp.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_qp.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_qp.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_qp.c 2007-08-06 00:37:39.000000000 +0200
+@@ -450,12 +450,13 @@ struct ib_qp *ehca_create_qp(struct ib_p
+ if (pd->uobject && udata)
+ context = pd->uobject->context;
+
+- my_qp = kmem_cache_zalloc(qp_cache, GFP_KERNEL);
++ my_qp = kmem_cache_alloc(qp_cache, GFP_KERNEL);
+ if (!my_qp) {
+ ehca_err(pd->device, "pd=%p not enough memory to alloc qp", pd);
+ return ERR_PTR(-ENOMEM);
+ }
+
++ memset(my_qp, 0, sizeof(*my_qp));
+ memset (&parms, 0, sizeof(struct ehca_alloc_qp_parms));
+ spin_lock_init(&my_qp->spinlock_s);
+ spin_lock_init(&my_qp->spinlock_r);
diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/kernel_patches/backport/2.6.16_sles10/ehca_kmem_cache_zalloc_to_2_6_16.patch ofa_1_2_c_kernel-20070804-0200/kernel_patches/backport/2.6.16_sles10/ehca_kmem_cache_zalloc_to_2_6_16.patch
--- ofa_1_2_c_kernel-20070804-0200_orig/kernel_patches/backport/2.6.16_sles10/ehca_kmem_cache_zalloc_to_2_6_16.patch 1970-01-01 01:00:00.000000000 +0100
+++ ofa_1_2_c_kernel-20070804-0200/kernel_patches/backport/2.6.16_sles10/ehca_kmem_cache_zalloc_to_2_6_16.patch 2007-08-06 00:56:20.000000000 +0200
@@ -0,0 +1,97 @@
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_cq.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_cq.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_cq.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_cq.c 2007-08-06 00:41:50.000000000 +0200
+@@ -134,13 +134,14 @@ struct ib_cq *ehca_create_cq(struct ib_d
+ if (cqe >= 0xFFFFFFFF - 64 - additional_cqe)
+ return ERR_PTR(-EINVAL);
+
+- my_cq = kmem_cache_zalloc(cq_cache, GFP_KERNEL);
++ my_cq = kmem_cache_alloc(cq_cache, GFP_KERNEL);
+ if (!my_cq) {
+ ehca_err(device, "Out of memory for ehca_cq struct device=%p",
+ device);
+ return ERR_PTR(-ENOMEM);
+ }
+
++ memset(my_cq, 0, sizeof(*my_cq));
+ memset(¶m, 0, sizeof(struct ehca_alloc_cq_parms));
+
+ spin_lock_init(&my_cq->spinlock);
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_main.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_main.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_main.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_main.c 2007-08-06 00:40:58.000000000 +0200
+@@ -113,9 +113,11 @@ static struct kmem_cache *ctblk_cache =
+
+ void *ehca_alloc_fw_ctrlblock(gfp_t flags)
+ {
+- void *ret = kmem_cache_zalloc(ctblk_cache, flags);
++ void *ret = kmem_cache_alloc(ctblk_cache, flags);
+ if (!ret)
+ ehca_gen_err("Out of memory for ctblk");
++ else
++ memset(ret, 0, EHCA_PAGESIZE);
+ return ret;
+ }
+
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_mrmw.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_mrmw.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_mrmw.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_mrmw.c 2007-08-06 00:39:30.000000000 +0200
+@@ -55,8 +55,9 @@ static struct ehca_mr *ehca_mr_new(void)
+ {
+ struct ehca_mr *me;
+
+- me = kmem_cache_zalloc(mr_cache, GFP_KERNEL);
++ me = kmem_cache_alloc(mr_cache, GFP_KERNEL);
+ if (me) {
++ memset(me, 0, sizeof(*me));
+ spin_lock_init(&me->mrlock);
+ } else
+ ehca_gen_err("alloc failed");
+@@ -73,8 +74,9 @@ static struct ehca_mw *ehca_mw_new(void)
+ {
+ struct ehca_mw *me;
+
+- me = kmem_cache_zalloc(mw_cache, GFP_KERNEL);
++ me = kmem_cache_alloc(mw_cache, GFP_KERNEL);
+ if (me) {
++ memset(me, 0, sizeof(*me));
+ spin_lock_init(&me->mwlock);
+ } else
+ ehca_gen_err("alloc failed");
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_pd.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_pd.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_pd.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_pd.c 2007-08-06 00:38:14.000000000 +0200
+@@ -50,13 +50,14 @@ struct ib_pd *ehca_alloc_pd(struct ib_de
+ {
+ struct ehca_pd *pd;
+
+- pd = kmem_cache_zalloc(pd_cache, GFP_KERNEL);
++ pd = kmem_cache_alloc(pd_cache, GFP_KERNEL);
+ if (!pd) {
+ ehca_err(device, "device=%p context=%p out of memory",
+ device, context);
+ return ERR_PTR(-ENOMEM);
+ }
+
++ memset(pd, 0, sizeof(*pd));
+ pd->ownpid = current->tgid;
+
+ /*
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_qp.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_qp.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_qp.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_qp.c 2007-08-06 00:37:39.000000000 +0200
+@@ -450,12 +450,13 @@ struct ib_qp *ehca_create_qp(struct ib_p
+ if (pd->uobject && udata)
+ context = pd->uobject->context;
+
+- my_qp = kmem_cache_zalloc(qp_cache, GFP_KERNEL);
++ my_qp = kmem_cache_alloc(qp_cache, GFP_KERNEL);
+ if (!my_qp) {
+ ehca_err(pd->device, "pd=%p not enough memory to alloc qp", pd);
+ return ERR_PTR(-ENOMEM);
+ }
+
++ memset(my_qp, 0, sizeof(*my_qp));
+ memset (&parms, 0, sizeof(struct ehca_alloc_qp_parms));
+ spin_lock_init(&my_qp->spinlock_s);
+ spin_lock_init(&my_qp->spinlock_r);
diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/kernel_patches/backport/2.6.16_sles10_sp1/ehca_kmem_cache_zalloc_to_2_6_16.patch ofa_1_2_c_kernel-20070804-0200/kernel_patches/backport/2.6.16_sles10_sp1/ehca_kmem_cache_zalloc_to_2_6_16.patch
--- ofa_1_2_c_kernel-20070804-0200_orig/kernel_patches/backport/2.6.16_sles10_sp1/ehca_kmem_cache_zalloc_to_2_6_16.patch 1970-01-01 01:00:00.000000000 +0100
+++ ofa_1_2_c_kernel-20070804-0200/kernel_patches/backport/2.6.16_sles10_sp1/ehca_kmem_cache_zalloc_to_2_6_16.patch 2007-08-06 00:56:33.000000000 +0200
@@ -0,0 +1,97 @@
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_cq.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_cq.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_cq.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_cq.c 2007-08-06 00:41:50.000000000 +0200
+@@ -134,13 +134,14 @@ struct ib_cq *ehca_create_cq(struct ib_d
+ if (cqe >= 0xFFFFFFFF - 64 - additional_cqe)
+ return ERR_PTR(-EINVAL);
+
+- my_cq = kmem_cache_zalloc(cq_cache, GFP_KERNEL);
++ my_cq = kmem_cache_alloc(cq_cache, GFP_KERNEL);
+ if (!my_cq) {
+ ehca_err(device, "Out of memory for ehca_cq struct device=%p",
+ device);
+ return ERR_PTR(-ENOMEM);
+ }
+
++ memset(my_cq, 0, sizeof(*my_cq));
+ memset(¶m, 0, sizeof(struct ehca_alloc_cq_parms));
+
+ spin_lock_init(&my_cq->spinlock);
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_main.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_main.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_main.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_main.c 2007-08-06 00:40:58.000000000 +0200
+@@ -113,9 +113,11 @@ static struct kmem_cache *ctblk_cache =
+
+ void *ehca_alloc_fw_ctrlblock(gfp_t flags)
+ {
+- void *ret = kmem_cache_zalloc(ctblk_cache, flags);
++ void *ret = kmem_cache_alloc(ctblk_cache, flags);
+ if (!ret)
+ ehca_gen_err("Out of memory for ctblk");
++ else
++ memset(ret, 0, EHCA_PAGESIZE);
+ return ret;
+ }
+
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_mrmw.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_mrmw.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_mrmw.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_mrmw.c 2007-08-06 00:39:30.000000000 +0200
+@@ -55,8 +55,9 @@ static struct ehca_mr *ehca_mr_new(void)
+ {
+ struct ehca_mr *me;
+
+- me = kmem_cache_zalloc(mr_cache, GFP_KERNEL);
++ me = kmem_cache_alloc(mr_cache, GFP_KERNEL);
+ if (me) {
++ memset(me, 0, sizeof(*me));
+ spin_lock_init(&me->mrlock);
+ } else
+ ehca_gen_err("alloc failed");
+@@ -73,8 +74,9 @@ static struct ehca_mw *ehca_mw_new(void)
+ {
+ struct ehca_mw *me;
+
+- me = kmem_cache_zalloc(mw_cache, GFP_KERNEL);
++ me = kmem_cache_alloc(mw_cache, GFP_KERNEL);
+ if (me) {
++ memset(me, 0, sizeof(*me));
+ spin_lock_init(&me->mwlock);
+ } else
+ ehca_gen_err("alloc failed");
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_pd.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_pd.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_pd.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_pd.c 2007-08-06 00:38:14.000000000 +0200
+@@ -50,13 +50,14 @@ struct ib_pd *ehca_alloc_pd(struct ib_de
+ {
+ struct ehca_pd *pd;
+
+- pd = kmem_cache_zalloc(pd_cache, GFP_KERNEL);
++ pd = kmem_cache_alloc(pd_cache, GFP_KERNEL);
+ if (!pd) {
+ ehca_err(device, "device=%p context=%p out of memory",
+ device, context);
+ return ERR_PTR(-ENOMEM);
+ }
+
++ memset(pd, 0, sizeof(*pd));
+ pd->ownpid = current->tgid;
+
+ /*
+diff -Nurp ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_qp.c ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_qp.c
+--- ofa_1_2_c_kernel-20070804-0200_orig/drivers/infiniband/hw/ehca/ehca_qp.c 2007-08-04 11:00:05.000000000 +0200
++++ ofa_1_2_c_kernel-20070804-0200/drivers/infiniband/hw/ehca/ehca_qp.c 2007-08-06 00:37:39.000000000 +0200
+@@ -450,12 +450,13 @@ struct ib_qp *ehca_create_qp(struct ib_p
+ if (pd->uobject && udata)
+ context = pd->uobject->context;
+
+- my_qp = kmem_cache_zalloc(qp_cache, GFP_KERNEL);
++ my_qp = kmem_cache_alloc(qp_cache, GFP_KERNEL);
+ if (!my_qp) {
+ ehca_err(pd->device, "pd=%p not enough memory to alloc qp", pd);
+ return ERR_PTR(-ENOMEM);
+ }
+
++ memset(my_qp, 0, sizeof(*my_qp));
+ memset (&parms, 0, sizeof(struct ehca_alloc_qp_parms));
+ spin_lock_init(&my_qp->spinlock_s);
+ spin_lock_init(&my_qp->spinlock_r);
More information about the general
mailing list