From patchwork Wed Nov 4 02:32:12 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "xiaofeng.yan" X-Patchwork-Id: 11879509 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 15DD9139F for ; Wed, 4 Nov 2020 02:31:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E9BD92225B for ; Wed, 4 Nov 2020 02:31:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="mJnN2UfY" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730610AbgKDCau (ORCPT ); Tue, 3 Nov 2020 21:30:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729188AbgKDCau (ORCPT ); Tue, 3 Nov 2020 21:30:50 -0500 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3113CC061A4D; Tue, 3 Nov 2020 18:30:50 -0800 (PST) Received: by mail-pg1-x541.google.com with SMTP id r10so15240409pgb.10; Tue, 03 Nov 2020 18:30:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=04L8R9f2Gx+AmkCjZy4qEyOdrMXDoh2NWWiRBE44Otc=; b=mJnN2UfYqY43eDrfQsbEZORdEow/OoODbX1+v6J5gNSu9F+4sB5ZmrZ8SSvXWlPqiv sN9difDihc4Whks/Prj/zwfZ9AzoOcViXSLL/757PMKauOTutMyAPgrqizaIQjmdUsq5 0mtJvAbFjoOOLF+nRDXZxlVgLuMXngtHxxPs/zGRHueTwsPuI5tdZzBNPmQXfDXfuynf 09fYvmMRCbXVzi/uWXUqGe7u2LBxkaio/1bHPHuJdqfYBX16PRZCjCGzM8X0E0ghrxIJ PG5/AZh6D7WDwy4I231AaygTy3Q8DljIUd7VDrOn/r9yf1iro4d7lz3/PLVmJxoJ/pYo T1yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=04L8R9f2Gx+AmkCjZy4qEyOdrMXDoh2NWWiRBE44Otc=; b=mmHH3BCKYiQzRuTpNYyeUrRQTXUsTo3FBtNpj/bbVXgeXsny5hRxGaLnvf/I6Wb9lQ rgTzVbkV726aXngoAlXAnBO1jKIhInLlROj8Aa85r+NNJxVIyNJajJPg9cOuBk8guyh6 iQsDLlAO1tKm28w+r3T7pEygESKxznhKQ0dkxEvNZz5N7JcyWMOs4qXlI7VocG5B0cU1 dEZbh7ibnQyPO1c5Wj/av3TwfEJhc3PkPlVISLIfGnrV58Y9T90xKTVAsHeeLy81WDLg Ndmc41wk9fAie2Y8wa3ubnLRn6rT/BHen0T4krvk3QYUZbw0PROE0NRhwVbESTxfbL6j 9IdA== X-Gm-Message-State: AOAM533k/XhVrlHeWr27msXDtNkCyTG10D8Inl0dlG3sUjRYkFUdudtn 0Xty/E6iqF0GEdDC3uJAjbA= X-Google-Smtp-Source: ABdhPJxHLzphM1sp2oCBLcKx8rtkXtUAoybxScZnRXrGbyrhl4rFwCRO69HvQisX+eFlOV2XgOF21g== X-Received: by 2002:a17:90a:ea93:: with SMTP id h19mr2209512pjz.107.1604457049852; Tue, 03 Nov 2020 18:30:49 -0800 (PST) Received: from ZB-PF11LQ25.360buyad.local ([137.116.162.235]) by smtp.gmail.com with ESMTPSA id j19sm443238pfn.107.2020.11.03.18.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 18:30:49 -0800 (PST) From: "xiaofeng.yan" To: willy@infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, dledford@redhat.com, jgg@ziepe.ca, oulijun@huawei.com, yanxiaofeng7@jd.com, xiaofeng.yan2012@gmail.com Subject: [PATCH 1/2] [xarry]:Fixed an issue with memory allocated using the GFP_KERNEL flag in spinlocks Date: Wed, 4 Nov 2020 10:32:12 +0800 Message-Id: <20201104023213.760-1-xiaofeng.yan2012@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: "xiaofeng.yan" function xa_store_irq() has a spinlock as follows: xa_lock_irq() -->spin_lock_irq(&(xa)->xa_lock) GFP_KERNEL flag could cause sleep. So change GFP_KERNEL to GFP_ATOMIC and Romve "gfp_t gfp" in function static inline void *xa_store_irq(struct xarray *xa, unsigned long index, void *entry, gfp_t gfp) Signed-off-by: xiaofeng.yan --- include/linux/xarray.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/linux/xarray.h b/include/linux/xarray.h index 92c0160b3352..aeaf97d5642f 100644 --- a/include/linux/xarray.h +++ b/include/linux/xarray.h @@ -595,7 +595,6 @@ static inline void *xa_store_bh(struct xarray *xa, unsigned long index, * @xa: XArray. * @index: Index into array. * @entry: New entry. - * @gfp: Memory allocation flags. * * This function is like calling xa_store() except it disables interrupts * while holding the array lock. @@ -605,12 +604,12 @@ static inline void *xa_store_bh(struct xarray *xa, unsigned long index, * Return: The old entry at this index or xa_err() if an error happened. */ static inline void *xa_store_irq(struct xarray *xa, unsigned long index, - void *entry, gfp_t gfp) + void *entry) { void *curr; xa_lock_irq(xa); - curr = __xa_store(xa, index, entry, gfp); + curr = __xa_store(xa, index, entry, GFP_ATOMIC); xa_unlock_irq(xa); return curr; From patchwork Wed Nov 4 02:32:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "xiaofeng.yan" X-Patchwork-Id: 11879511 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 399286A2 for ; Wed, 4 Nov 2020 02:31:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1D99B216C4 for ; Wed, 4 Nov 2020 02:31:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZfXXQrNL" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730641AbgKDCax (ORCPT ); Tue, 3 Nov 2020 21:30:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730576AbgKDCax (ORCPT ); Tue, 3 Nov 2020 21:30:53 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AACDC061A4D; Tue, 3 Nov 2020 18:30:53 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id 13so16048094pfy.4; Tue, 03 Nov 2020 18:30:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=ptosR5vhEbiMhlxkFVcBuL1a0n21eSL1TE17XqRrfvM=; b=ZfXXQrNLKoLHI7wCDCxp/1qrH8BqQKhUw3VSrGjD+GcGyXRzNyaI6Avu/IEWVdvb5m lEjvYqW+fhfR253pqXdEo6fqzR+viCnYfHn2Nygm9QHdNL5v3eLCX9Qc+cJ+gsPIYL3K 8qVQrGFUYIZ6h74WkK6HNP1TspNB6yI4WafJsYpFlvhkiGnyBTzoQckE7+0FoyDENTr9 JZIY8xAdT19cUgfI5Bn+9tJk+zGHe5bRTlpfAGhOf89PZmNCZ3bfSqv0RQVKXrHtig/B WDwRVQkb8PH3yd97nTtWfc/2m+SqNxOzIPGyKZdDHA0wVKUpQdgAXPXO3EM9nCdYB8H4 6Krw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=ptosR5vhEbiMhlxkFVcBuL1a0n21eSL1TE17XqRrfvM=; b=YXqxVA+GePS0s1UEvLDovQr1adpnva/bZE5ke8fP2nTb/ppqWoGhg4jFEaJI5QntJ5 2zjnXRoCkiVMitOlsPEU1H93uOo2NWmNrqsnZGgKskpHNHkBoZiYigcd5i6DclABwh9d LgIwRA3OkM/ePS4GZ7UlnR4K5c4yb1VqfMYlVEmTHDgDJgJEfRMP8jxpsNKyrHLvdsQY 0BvhuMA7/s6kIlrj0lbV/oOJyunYu/OlZgy/PT8WEKrSLX3Y+MH/1ALwVu7y95mudiTK 4oTQgG05eXSMBQk3o0OWeXO7r0MY0kXZByo5aXCL3Hq6/Lr+JEDF+udH/hca9S/FhsOw /g9Q== X-Gm-Message-State: AOAM532Arr0slwPNiEY0rMiJus7fd1h5PYCTPq6Lo8Woc40gkWSKJB8t 1J/HuySH4ZBB01+gAYd9zbs= X-Google-Smtp-Source: ABdhPJztQmFCoSN+ZE4wdVkghQDsGxz/6uszo82h6dL5MOgdDyIrA2WEVGWvqQ9HhcertOcNac5yYg== X-Received: by 2002:aa7:9245:0:b029:156:552a:1275 with SMTP id 5-20020aa792450000b0290156552a1275mr28647930pfp.12.1604457052866; Tue, 03 Nov 2020 18:30:52 -0800 (PST) Received: from ZB-PF11LQ25.360buyad.local ([137.116.162.235]) by smtp.gmail.com with ESMTPSA id j19sm443238pfn.107.2020.11.03.18.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 18:30:52 -0800 (PST) From: "xiaofeng.yan" To: willy@infradead.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, dledford@redhat.com, jgg@ziepe.ca, oulijun@huawei.com, yanxiaofeng7@jd.com, xiaofeng.yan2012@gmail.com Subject: [PATCH 2/2] infiniband: Modify the reference to xa_store_irq() because the parameter of this function has changed Date: Wed, 4 Nov 2020 10:32:13 +0800 Message-Id: <20201104023213.760-2-xiaofeng.yan2012@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201104023213.760-1-xiaofeng.yan2012@gmail.com> References: <20201104023213.760-1-xiaofeng.yan2012@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org From: "xiaofeng.yan" function xa_store_irq() has three parameters because of removing patameter "gfp_t gfp" Signed-off-by: xiaofeng.yan --- drivers/infiniband/core/cm.c | 2 +- drivers/infiniband/hw/hns/hns_roce_qp.c | 2 +- drivers/infiniband/hw/mlx5/srq_cmd.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index 5740d1ba3568..afcb5711270b 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c @@ -879,7 +879,7 @@ static struct cm_id_private *cm_alloc_id_priv(struct ib_device *device, static void cm_finalize_id(struct cm_id_private *cm_id_priv) { xa_store_irq(&cm.local_id_table, cm_local_id(cm_id_priv->id.local_id), - cm_id_priv, GFP_KERNEL); + cm_id_priv); } struct ib_cm_id *ib_create_cm_id(struct ib_device *device, diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c index 6c081dd985fc..1876a51f9e08 100644 --- a/drivers/infiniband/hw/hns/hns_roce_qp.c +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c @@ -237,7 +237,7 @@ static int hns_roce_qp_store(struct hns_roce_dev *hr_dev, if (!hr_qp->qpn) return -EINVAL; - ret = xa_err(xa_store_irq(xa, hr_qp->qpn, hr_qp, GFP_KERNEL)); + ret = xa_err(xa_store_irq(xa, hr_qp->qpn, hr_qp)); if (ret) dev_err(hr_dev->dev, "Failed to xa store for QPC\n"); else diff --git a/drivers/infiniband/hw/mlx5/srq_cmd.c b/drivers/infiniband/hw/mlx5/srq_cmd.c index db889ec3fd48..f277e264ceab 100644 --- a/drivers/infiniband/hw/mlx5/srq_cmd.c +++ b/drivers/infiniband/hw/mlx5/srq_cmd.c @@ -578,7 +578,7 @@ int mlx5_cmd_create_srq(struct mlx5_ib_dev *dev, struct mlx5_core_srq *srq, refcount_set(&srq->common.refcount, 1); init_completion(&srq->common.free); - err = xa_err(xa_store_irq(&table->array, srq->srqn, srq, GFP_KERNEL)); + err = xa_err(xa_store_irq(&table->array, srq->srqn, srq)); if (err) goto err_destroy_srq_split;