From patchwork Thu Mar 30 05:51:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 13193399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 527AFC6FD1D for ; Thu, 30 Mar 2023 05:52:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229717AbjC3Fwx (ORCPT ); Thu, 30 Mar 2023 01:52:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjC3Fww (ORCPT ); Thu, 30 Mar 2023 01:52:52 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2043.outbound.protection.outlook.com [40.107.244.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 273965259 for ; Wed, 29 Mar 2023 22:52:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LfcmObH18gnjQighvpDeNbbokZD9pvh4hSvOoeWtRyXVW0MOD7FRp0YJFvtSQQ/H2SzIqvVDn4BXLnbZrxfrx031Gw/xjKMD+k8wQf2dzC/i4Kb7K9tracoTl+R5QE7Z9+7h+JUqD2jFSsTvFIhmjR7dtEf8TGLSgzVqb39ADU9IUhEhSqRSU3niOKd0clrk/lzSt15Lm8Di3/ADDGNoXDTjD4rEF2qH3uM7Cl9mzXLre8OZxn8loBcy9IZQvUKdm6WyCNgWyYZHTWVRmZuAH8JYes5YpcLUIZQvz+0mN0bTFrzZj8JAYNgiXr3agrr/SUdpjU+FsbiKKbNN733TlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MnHEwVtX6rCM1SbFLyM3eeEcPiEfV00FTzVpdzdnlvg=; b=Pcmw5AZrJL3cSU1cLXhmU4IGnJsX4e1gCrvZQSlT3k6OtWDvOdxKfb4vSVTUZvBzAAdTxO5DDpdCF8y0qp4QcqpwWwTylfpqX6FrKQ/4W1iO/+jjuuyqoQgCrQIDeSfZg8zcFIqp899cYY7nbFktblNAAtLtZwwTwSO7h+C2Hv1M5Zx5O3S4hy2ZSsMDUr6oiQg2vgk7UuVEI5fLZZL4WEUgZfU60Uz7Yo4YOxpb4eBMY2OGvhVXd0q1IbOeGEr8Vx1hatlKtKOarbfd2xhJd7wS60/DlD6uvBYPb4Qo0Q237jGo489P7h04tbuwpS75OS2+mDtippgono12f/t/+A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MnHEwVtX6rCM1SbFLyM3eeEcPiEfV00FTzVpdzdnlvg=; b=KKBTFVNW/5YR+wbSaln0e5vatKGif2KsoLmXANCXeaRSfHhRwvv55uu/0ctNsTINNQkRNuzbqaeWsKtCRv4ick/oH2J9WTYpDMFvX6XSxLExhqopJlkGUCApaOaPvSWGdeRGo+ZUQejJC2MLjhezr3xHChgfZaIZ4YJ+6eMnpLy1sWJjCL9HK0fIcN5WHjsg2l6W+G2yQavuaGVSUNzJ5bg7O/HkuGKGgPfS8mgUsq5CNmbNLq0eSDhGBpcHmxDbzGXCaicJM/puHGikBgmKCEvhwtewnTmRnsvHuBdUkf+7I2FSRGBwXyhLkIj/xeVLT1f5VE7f4tiXK8u6tFaByg== Received: from MN2PR19CA0022.namprd19.prod.outlook.com (2603:10b6:208:178::35) by IA0PR12MB8351.namprd12.prod.outlook.com (2603:10b6:208:40e::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.21; Thu, 30 Mar 2023 05:52:47 +0000 Received: from BL02EPF00010206.namprd05.prod.outlook.com (2603:10b6:208:178:cafe::f6) by MN2PR19CA0022.outlook.office365.com (2603:10b6:208:178::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22 via Frontend Transport; Thu, 30 Mar 2023 05:52:42 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF00010206.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Thu, 30 Mar 2023 05:52:42 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 29 Mar 2023 22:52:23 -0700 Received: from dev.nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 29 Mar 2023 22:52:22 -0700 From: Chaitanya Kulkarni To: CC: , , , , , , , Subject: [PATCH 1/9] null_blk: adjust null_param_store_val() Date: Wed, 29 Mar 2023 22:51:55 -0700 Message-ID: <20230330055203.43064-2-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20230330055203.43064-1-kch@nvidia.com> References: <20230330055203.43064-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010206:EE_|IA0PR12MB8351:EE_ X-MS-Office365-Filtering-Correlation-Id: 26ded4d8-4d26-4f89-8590-08db30e2fa97 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6Hu6zX58FgRZ/UrmELWjybwljN3MpU0h87tXWmdNT7RNlExmkRxhVNTCDpBPWVqldsq6DhVO+wRDsEXOc/Ov61sAWPB/WdWDHlXVE03rIfxIFZFbPcsEOgMpLEmRiers2fQ27AAvnzRSZiF9kjv5aI6d2cB2b1nDIk4K0VuZ8uA4a3e0NciW7pbBi/pHelhXtRu4sZaNHWBj4lgljsMXL5Gtvp3aK+7op2VYUzzzTFDuV0WFNPwfWeXcV0KkmptNtrb9dJgZcx4xwflA41ts6B0d+EP0C9shEzcGb4o5AteB6w/L7ZCuej1o5wRPjQ0ZSooykZ+Crqr925KRNepp1g1AGRsjMXlOVjXv/ISx90UT6aT/TZcZ9Wf/z9XqGOaODHAEOCECW46bpQqqtPrL120wvhOFvo43eFxVjZx9JZWjBeNEVUcZWWBZq8sFoGreY07ofmuZF6AtqFxzwwXf88rezSIfKhYbYUXU9IA/dlRtn428M+dSI35q1eTgEoP8jfLiQsy5Kf2M4wz/8mvqVM83bGO9zDz/ol8dCRNuzh7Cer9bYHGG0AokMAgZwkUqdQd4WOkV2Z9o9LXxDtAXa3ssqxZVPlbmWMmF1uzREASTz7DlVBasA+JErrbwDAxzmvKIwZ4uOdd85CufI7JohnIgSa0uXU+Q/gFqaJOvXsBAO4LrRTWsC36yj/ChFkfOnL9XibAY6PkU7S/ON67ZX/B7E8z0+sPXZF7xZm/dXfn0rDck6WwXV3kfoyHZ6z1J X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(376002)(396003)(346002)(39860400002)(136003)(451199021)(40470700004)(46966006)(36840700001)(356005)(7636003)(8676002)(478600001)(6666004)(8936002)(40480700001)(70206006)(70586007)(6916009)(4326008)(54906003)(82310400005)(36860700001)(82740400003)(41300700001)(40460700003)(316002)(186003)(16526019)(1076003)(26005)(36756003)(47076005)(2616005)(426003)(336012)(83380400001)(2906002)(5660300002)(7696005);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 05:52:42.6003 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 26ded4d8-4d26-4f89-8590-08db30e2fa97 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010206.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8351 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Move null_param_store_val() top of all the module parameter decalrations so it can be used by next patches in this series, also while at it rename this function to null_param_store_int() since it is only validating values of type int and not generic one. No functional change in this pacth. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk/main.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 9e6b032c8ecc..cf6937f4cfa1 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -77,6 +77,21 @@ enum { NULL_IRQ_TIMER = 2, }; +static int null_param_store_int(const char *str, int *val, int min, int max) +{ + int ret, new_val; + + ret = kstrtoint(str, 10, &new_val); + if (ret) + return -EINVAL; + + if (new_val < min || new_val > max) + return -EINVAL; + + *val = new_val; + return 0; +} + static bool g_virt_boundary = false; module_param_named(virt_boundary, g_virt_boundary, bool, 0444); MODULE_PARM_DESC(virt_boundary, "Require a virtual boundary for the device. Default: False"); @@ -117,24 +132,9 @@ MODULE_PARM_DESC(init_hctx, "Fault injection to fail hctx init. init_hctx= max) - return -EINVAL; - - *val = new_val; - return 0; -} - static int null_set_queue_mode(const char *str, const struct kernel_param *kp) { - return null_param_store_val(str, &g_queue_mode, NULL_Q_BIO, NULL_Q_MQ); + return null_param_store_int(str, &g_queue_mode, NULL_Q_BIO, NULL_Q_MQ); } static const struct kernel_param_ops null_queue_mode_param_ops = { @@ -177,7 +177,7 @@ static int g_irqmode = NULL_IRQ_SOFTIRQ; static int null_set_irqmode(const char *str, const struct kernel_param *kp) { - return null_param_store_val(str, &g_irqmode, NULL_IRQ_NONE, + return null_param_store_int(str, &g_irqmode, NULL_IRQ_NONE, NULL_IRQ_TIMER); } From patchwork Thu Mar 30 05:51:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 13193400 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7BDFBC74A5B for ; Thu, 30 Mar 2023 05:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229827AbjC3Fw4 (ORCPT ); Thu, 30 Mar 2023 01:52:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjC3Fwz (ORCPT ); Thu, 30 Mar 2023 01:52:55 -0400 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2065.outbound.protection.outlook.com [40.107.96.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 74FC149FE for ; Wed, 29 Mar 2023 22:52:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ELzF79Ln7DgrbCTgaQtrBHcMsSyYKtMnzjjjooEEAws+uPU1oelbJWJ3Jit5U9jspyo6uayo2b8E38qARHC4UgK8/b44BROkE7tfhwJhDIWDS/5rXvzUKox5BpIdEQhycvYXCBd6H6jmpR9QdOrDwu9IxC16DFmzFELnb0mfLzAUHwHbLdAjqKZXNksn+3h3IASs0FGef2VVdGc/sn3AYRstCGMwNr34X2LVLokOcK46ukvTtQHCvvRRY8cWkTfsIl9xvepE3TetwOqkGHR4Z+GgwEG+D9XDoMpYyhkCgCVtXbEFfjAwxOeOyKW1TU8bf4qb0jaoj5EjEuq2YvMNwA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=2rhL85XEERYkQDfbI7NGkA6TTlVmWKwCDKOaBub5UKM=; b=oJEoaE580u6W10oxwS1jw5Utb/Po40q0yQ+bkh29RwH2T9ysjU40Ep9UbTU9H/OW3fsTGi0fZK4aktceugCV4u09N6Q6aMgWb1OH0SwA+EHNOZuQ87mj+qnjo3qRLfKyM0Zc+Jyz6hnbSrbDgJBExdeqlW/wNrLF/ikr9WAp1SxYMaPzLGsugpoD/UI5dVUfkDOv2FS6LyZYaJQ4bPr4Do1dY6FyfALdufCX9wLf89q1ufUXVfFAMQBvULZlz+dYDLH8ejcIfNJ+ev4YbwJ1I667oGVfZmb2ZrPxRAlHWjo87NiWgnlfOTSm2Fuq1+LsDYxBDTLEMOp1AfhSIaGsjA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=2rhL85XEERYkQDfbI7NGkA6TTlVmWKwCDKOaBub5UKM=; b=h9dAFVPqCo4SnRmKs7LEpW4//ecd3rnF9RjRfAzmrKV3lUILfQodvNPYfRKcfH9fWk9iWcC+aqbBWcS2i5RTWUDvAZevODWhm4NiZREo5oGXDoOBgvEUEpNhMXzwWbl8gtETXDJNOA5BvOkaZqB6+7zln+/oT776m8nd6b1ACNsCxlsQB+lzLcvhEUZjwbjrvHyse4vDx6hNzT7lv/T6GHwiZ5gV1fWUU6udpz9yjOk/ouy9tHNBoyT1BRN6OGfHGdlssMOA6tQpYwCvjzR7Ud/Jc+uiu4GxHXFdF3cOz2XqFM+Mg9VBKDycf4LCP2GylMTMHVAkNxjWhszdfB6SPA== Received: from BN9PR03CA0793.namprd03.prod.outlook.com (2603:10b6:408:13f::18) by DM6PR12MB4484.namprd12.prod.outlook.com (2603:10b6:5:28f::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.33; Thu, 30 Mar 2023 05:52:52 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:408:13f:cafe::8e) by BN9PR03CA0793.outlook.office365.com (2603:10b6:408:13f::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22 via Frontend Transport; Thu, 30 Mar 2023 05:52:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Thu, 30 Mar 2023 05:52:52 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 29 Mar 2023 22:52:34 -0700 Received: from dev.nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 29 Mar 2023 22:52:33 -0700 From: Chaitanya Kulkarni To: CC: , , , , , , , Subject: [PATCH 2/9] null_blk: check for valid submit_queue value Date: Wed, 29 Mar 2023 22:51:56 -0700 Message-ID: <20230330055203.43064-3-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20230330055203.43064-1-kch@nvidia.com> References: <20230330055203.43064-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|DM6PR12MB4484:EE_ X-MS-Office365-Filtering-Correlation-Id: 665f9624-b3b9-4f59-abdc-08db30e30039 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hgJD0bkSBf6T9ZmJkHlECiFO9W/+enDaiOqtouqmnaPcx+Rr4mMLpKiZMyQOZ30wDPDYDj+qR6BpSNsbO1NbQ5hCQx8FH6xjEyCa/JOnItq7HOJxqI8Mz60BNF6sbtVjQHU0zbBvIZoAqsuW/1jFRflHEdIKBC1XHsnezCMYXbdKfjI8kCAhuqeJKQWWYVm7o1FLjHDct/NhCXTE/peVcx9FBpqHmYvwoYHHzmhE8rVILgFW7yuncppXwT4qOmT+O/dIS8wBEyFrSXFrdxu/AuTMimtarghV1c6vjSL3vkrFVdhzsTiVF/5YEwCQ84m7miz85PohP482U5G+wKR9/gineON9CEDL2V7gAxvZnUEfMe6SA8cBtUo6vpAsZeaMHhhLUT/z/Ly1NK5tDfLNtKmvbo52fFcK/Kqm2qVfT5CCuPFLC64tU2gjtAqfpvk3+FY26wUfibyM7+csSTVcoweFawpTfQxo2t9Vw9KYhEhi46BS6XX4p1JFgrO3QVk4Efq67aU04xFomBoXDH/okowzXMBBfPajF9F1AI2de2h9qhdCaFsw4QUywX27+LvYKUEA7GkagCJ4wfG8y2O00Qt3qPnV+6bYJZ8zAQ1R5Re1x4zpzCaqEqVV1gkU40ZiVlgGXnk/e1zp+9fqaJtDMy5ghw7WeKEI0+6Vhjs8g6PWvy8RCpSkzv5Ym6pgAPw2lcUPKkeSVgshdeZbz7VlKsU3k4wN6TwAoElPi5GeNpuTqAdhcayJiKhMFCRcd70L X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(346002)(376002)(39860400002)(451199021)(36840700001)(46966006)(40470700004)(41300700001)(40460700003)(8676002)(70206006)(2906002)(6916009)(70586007)(16526019)(4326008)(186003)(36756003)(426003)(336012)(82310400005)(83380400001)(47076005)(5660300002)(7636003)(82740400003)(356005)(36860700001)(40480700001)(2616005)(8936002)(478600001)(6666004)(54906003)(7696005)(26005)(1076003)(316002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 05:52:52.0516 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 665f9624-b3b9-4f59-abdc-08db30e30039 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4484 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Right now we don't check for valid module parameter value for submit_queue, that allows user to set negative values. Add a callback null_set_submit_queues() to error out when submit_queue value is < 1 before module is loaded. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index cf6937f4cfa1..9e3df92d0b98 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -100,8 +100,18 @@ static int g_no_sched; module_param_named(no_sched, g_no_sched, int, 0444); MODULE_PARM_DESC(no_sched, "No io scheduler"); +static int null_set_submit_queues(const char *s, const struct kernel_param *kp) +{ + return null_param_store_int(s, kp->arg, 1, INT_MAX); +} + +static const struct kernel_param_ops null_submit_queues_param_ops = { + .set = null_set_submit_queues, + .get = param_get_int, +}; + static int g_submit_queues = 1; -module_param_named(submit_queues, g_submit_queues, int, 0444); +device_param_cb(submit_queues, &null_submit_queues_param_ops, &g_submit_queues, 0444); MODULE_PARM_DESC(submit_queues, "Number of submission queues"); static int g_poll_queues = 1; From patchwork Thu Mar 30 05:51:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 13193401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 364DDC6FD1D for ; Thu, 30 Mar 2023 05:53:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229852AbjC3FxL (ORCPT ); Thu, 30 Mar 2023 01:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjC3FxK (ORCPT ); Thu, 30 Mar 2023 01:53:10 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2081.outbound.protection.outlook.com [40.107.100.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47662110 for ; Wed, 29 Mar 2023 22:53:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=h1174KVsEXGoNXGcId5n5OVt7VCqa0XbW8YK7zJvoqvySqSiqAnpD0qk+K3qJ4XWxTkzUAdya/Updh40dgcW0oCVZ2wY/SCQpEua42LMLrWIGGL6tmqmGbMMDpevcM9NjfJE5VuVCKT+US3cgOYdz97a2bblHBc+t4xIyUZ2DmfEuTBiE6VrWf6K/Z8QNuLmBnmR1EoEutdOY1S9JgF4C4oTQMzhMdgQ5+AgEpsmegLSKvCnfvNlUEgXOPFJWGP8XgAZx9GWcqok5mFpxP41U72zRKZNp2DPpywB3+IlyA8BsZngMjqWpxMVIn/1xndCuQEz3b3iliKTUKZj9VWMuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UpKfaU4aUwE561jEP5Yxy99XU3TX9SXG0DMD6WEFJSE=; b=S0NtOLVlxBJgGquid/SKZ7fVw4oih8BhZBt/KLheb31jk4tAKyzLst2c3DMw+C8Azgur2RDS3O9mO8RLGWFFoGIld7M5GWxhbbmcmIU2/f5OrPHQJvSW0SF+tm4r4w+D2knUS3GYFswe3C4KMSB29oP+ZkD/4nLTY6L8lBPY83/mGd/FMLTF3piGqz7S4VRKydUMfqAfk5qoalFRjJShSrmcCsM9VrkgS/rMa1aZBJhz0wA7Eo6PP15oBHKoYxYq6W68xuuM34Qu7/pYcU+emAfweEg10JeOf0LXs5iMl3d3tRoLUPw2H568WfJqysECVcdax4c2xyWId+dhVqRLQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UpKfaU4aUwE561jEP5Yxy99XU3TX9SXG0DMD6WEFJSE=; b=Qt5KMzqFM4Lw2bnM2gMrQLSJ5TpmuvOfnI2+V7pqigHld4D1B1ctAomUvXHW6EbcAUKDUyG4ZiAfMJkNrO6yg/jkqHhF3TmSW1HBwQWcPfNjgd1860SRAX6fyVegsfrlsqDGn8F39TDFFjuRYMXqERpjrIQHeT7R/7iCT/+v37Z2fpcgfkDTybIEFrrSAiw1C7BrCVKuwUjQD/gFBtFFcXVuJ5I7OBSus/F/d8PHbaGqjFYz40sloc4gQm+Xm0et+kArcrrXKSBOxqczFXImwzctnI1DkiEn6mNj9h1vMC5RWw2I9x5F7w9vepP0R8tvUzl85eJ4jarybrLEn8saxQ== Received: from BN9P223CA0007.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::12) by BL1PR12MB5350.namprd12.prod.outlook.com (2603:10b6:208:31d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.33; Thu, 30 Mar 2023 05:53:07 +0000 Received: from BL02EPF00010207.namprd05.prod.outlook.com (2603:10b6:408:10b:cafe::10) by BN9P223CA0007.outlook.office365.com (2603:10b6:408:10b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22 via Frontend Transport; Thu, 30 Mar 2023 05:53:07 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF00010207.mail.protection.outlook.com (10.167.241.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Thu, 30 Mar 2023 05:53:07 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 29 Mar 2023 22:52:45 -0700 Received: from dev.nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 29 Mar 2023 22:52:45 -0700 From: Chaitanya Kulkarni To: CC: , , , , , , , Subject: [PATCH 3/9] null_blk: check for valid poll_queue value Date: Wed, 29 Mar 2023 22:51:57 -0700 Message-ID: <20230330055203.43064-4-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20230330055203.43064-1-kch@nvidia.com> References: <20230330055203.43064-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010207:EE_|BL1PR12MB5350:EE_ X-MS-Office365-Filtering-Correlation-Id: dd18c635-f8a6-4d63-4c78-08db30e30923 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CTcJRpvmWHe1ajc2duI3d20Fj19S7c1hMhi11ujYLUGWmvK1Ec4Enx3BAcp5GEHb9oQLT5IklBCNXU7EsvI6GfQ5bwEV6yabGg2KwhTQK0hZgR8oClGgJWw44Mx/ByhFw79WQWPRE+xQuqVToZwCvlYRtCGmlUmJ4I/VojrAqSM4mUIEl526t+3yzOdqsNXEhFwTe+PK34rUqkg5C3UbyodY4JiXk6W9iWfhtVxqjKcgUdzI9oIun908BtvJSnCJpdwF5WcHM4hzNDaLGEVjIdlzrcgz/Xu9/W+B6KZ+NCmJ8LKpmYhrqguJpO1vXt3PCK/4kdkkbZTRHtMlLE9Mrb9zRf6uNRnnbMBjvGE8KVoA9GMRtAhdWtuvysokonOF+/JIajEr2clrUlhdVFWaF4sEmxU1FLo/4AbY07kJfNx2qozI4xQj7e60//+frvkB/etCqEXLj4svuR3cmV6hgy5xFZRDXtTW72yZwMTyK/zvDzZMOD8rWGBtRVRf8Ist6DGCZ9TavRn0vKeGcMhQYZis4lae+vC7Ha1zCnQx7OJrcmixRbWlikefYugU0iV7ukIdm5A4zDc1amR2x4j8jXaz7zO9TfgBldkVf26LjvPX6U7NdZ1J9ulLPwCjohn52pRh1QHC8dL11Fvwe5sgN++pjJcWGn6dXgeKNrhfMnMIf58Q+Xe4KC/5Bd1ntyVwsJNj6jqpqUHaPhPxZtwKoesIk7/f57pgv5XyunLCq500/TOKHvWjjR6P/RHYRBQGK23PyEECbKb2JC5pCEYP3Q== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(39860400002)(376002)(136003)(346002)(451199021)(36840700001)(46966006)(40470700004)(41300700001)(16526019)(40460700003)(40480700001)(83380400001)(356005)(5660300002)(54906003)(478600001)(7696005)(336012)(426003)(2906002)(82740400003)(47076005)(7636003)(36860700001)(6916009)(8676002)(4326008)(2616005)(70206006)(186003)(70586007)(36756003)(6666004)(82310400005)(8936002)(316002)(26005)(1076003)(473944003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 05:53:07.0043 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dd18c635-f8a6-4d63-4c78-08db30e30923 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010207.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5350 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Right now we don't check for valid module parameter value for poll_queue, that allows user to set negative values. Add a callback to error out when poll_queue value is set < 1 before module is loaded. This fixes following message with invalid poll_queues value set more than num_online_cpus(): $echo $(nproc) 48 $ for i in `seq 45 49`; do modprobe -r null_blk modprobe null_blk poll_queues=$i echo "poll_queues = $i" dmesg -c done poll_queues = 45 blk_queue_max_hw_sectors: set to minimum 8 null_blk: disk nullb0 created null_blk: module loaded blk_queue_max_hw_sectors: set to minimum 8 null_blk: disk nullb0 created null_blk: module loaded 46 blk_queue_max_hw_sectors: set to minimum 8 null_blk: disk nullb0 created null_blk: module loaded 47 blk_queue_max_hw_sectors: set to minimum 8 null_blk: disk nullb0 created null_blk: module loaded 48 blk_queue_max_hw_sectors: set to minimum 8 null_blk: disk nullb0 created null_blk: module loaded 49 ------------[ cut here ]------------ WARNING: CPU: 23 PID: 36379 at lib/group_cpus.c:400 group_cpus_evenly+0x26e/0x280 CPU: 23 PID: 36379 Comm: modprobe Tainted: G W O N 6.3.0-rc1lblk+ #2 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.14.0-0-g155821a1990b-prebuilt.qemu.org 04/01/2014 RIP: 0010:group_cpus_evenly+0x26e/0x280 Code: b1 ff 48 8b 7c 24 08 e8 20 d1 5d 00 48 8b 3c 24 e8 17 d1 5d 00 45 85 ed 0f 89 01 fe ff ff e9 f1 fd ff ff e8 b4 9d 8d ff eb ac <0f> 0b eb a8 e8 39 c4 60 00 41 bd f4 ff ff ff eb 9b cc 90 90 90 90 RSP: 0018:ffffc90000723cb8 EFLAGS: 00010297 RAX: 0000000080000000 RBX: 0000000000000031 RCX: 0000000000000000 RDX: 0000000000000001 RSI: 0000000000000030 RDI: 00000000ffffffff RBP: ffff88884b2204f0 R08: ffff88884b220bd8 R09: ffff8888c31f0000 R10: ffff88884b220bd8 R11: 0000000000000000 R12: ffff8888c31f0000 R13: 0000000000000000 R14: 0000000000000030 R15: 0000000000000000 FS: 00007f5ff6be8b80(0000) GS:ffff888fff7c0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f5ff6706800 CR3: 0000000849554000 CR4: 0000000000350ee0 DR0: ffffffff843793e0 DR1: ffffffff843793e1 DR2: ffffffff843793e2 DR3: ffffffff843793e3 DR6: 00000000ffff0ff0 DR7: 0000000000000600 Call Trace: blk_mq_map_queues+0x16/0xc0 null_map_queues+0xa5/0xe0 [null_blk] blk_mq_alloc_tag_set+0x14d/0x3f0 ? __kmalloc+0xbc/0x130 null_add_dev.part.0+0x601/0x700 [null_blk] null_init+0x109/0xff0 [null_blk] ? __pfx_init_module+0x10/0x10 [null_blk] do_one_initcall+0x44/0x220 ? kmalloc_trace+0x25/0x90 do_init_module+0x4c/0x210 __do_sys_finit_module+0xb4/0x130 do_syscall_64+0x3b/0x90 entry_SYSCALL_64_after_hwframe+0x72/0xdc RIP: 0033:0x7f5ff672c15d Code: c5 0c 00 0f 05 eb a9 66 0f 1f 44 00 00 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d e3 7c 0c 00 f7 d8 64 89 01 48 RSP: 002b:00007ffd32ca3148 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 000056096285db90 RCX: 00007f5ff672c15d RDX: 0000000000000000 RSI: 000056096285df00 RDI: 0000000000000003 RBP: 0000000000040000 R08: 0000000000000000 R09: 0000000000000020 R10: 0000000000000003 R11: 0000000000000246 R12: 000056096285df00 R13: 000056096285dcc0 R14: 000056096285db90 R15: 000056096285df20 ---[ end trace 0000000000000000 ]--- blk_queue_max_hw_sectors: set to minimum 8 null_blk: disk nullb0 created null_blk: module loaded Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 9e3df92d0b98..2d24c34ec172 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -114,8 +114,18 @@ static int g_submit_queues = 1; device_param_cb(submit_queues, &null_submit_queues_param_ops, &g_submit_queues, 0444); MODULE_PARM_DESC(submit_queues, "Number of submission queues"); +static int null_set_poll_queues(const char *s, const struct kernel_param *kp) +{ + return null_param_store_int(s, kp->arg, 1, num_online_cpus()); +} + +static const struct kernel_param_ops null_poll_queues_param_ops = { + .set = null_set_poll_queues, + .get = param_get_int, +}; + static int g_poll_queues = 1; -module_param_named(poll_queues, g_poll_queues, int, 0444); +device_param_cb(poll_queues, &null_poll_queues_param_ops, &g_poll_queues, 0444); MODULE_PARM_DESC(poll_queues, "Number of IOPOLL submission queues"); static int g_home_node = NUMA_NO_NODE; From patchwork Thu Mar 30 05:51:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 13193402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 071DEC74A5B for ; Thu, 30 Mar 2023 05:53:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229854AbjC3FxR (ORCPT ); Thu, 30 Mar 2023 01:53:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjC3FxR (ORCPT ); Thu, 30 Mar 2023 01:53:17 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2055.outbound.protection.outlook.com [40.107.95.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44A7512E for ; Wed, 29 Mar 2023 22:53:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EE2p6RaoVgSUJ55jcOCty3HFGxVW+4evZtoWLT94CvT/FOAFo6HHQpSu/bHMXENoly4ctCN+TDfa/fjyYfNk1ldLJVCZ6uWs0MN/XtprMPh0r1OM9ckOVpoDaw20r+fGtQ6EtkKvfDVsynpEcyEIdTSLilo+gV6X/FMBfhS10joe/aI+geWLYCTrd894jSBi8WD0tnRko4SEYukeWAO/YqHk/1BmPJbgWrNLlgj4u0W18yx6reLX+KlgDrGcOYgF6UmTIGGi/vTHXH2EgOYGXdjb37Wzfu1XNcJcNjkQQESp/bO9op67c5Ax5HwpDy6Cn3Bu1x53YU0Jery9/i2ITQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/mT1BwobzAmSXKMJqT3UWTa3C8DBTYxGwu9K90Go5wY=; b=Kzplg5qO4wxG4nYDJ1JJBlrtyL+b+AtTC6o4ITJVMBOMj5XMhmdcoIxnLPmaXnWDC4TAoVZq0LHUbRLqrcVDVlqjmZh/3RgUksPCmbUBTLDbXeyOvLf+b2pi4jJJwkII+sYR+5vnU9GjixtshAivP4GDJY7LsvEU9AhvgobBPdsxBCAJqTtTN/H1CSjsfKmj8PpqD7VXgQbcAO/aEj7T59HBJLo9y47F2L6XwIrf3gQ0+uypFM446I6T8YWgwJErPUp6pw/J4vX+icrQEOPl7Zp404bkJQHCZUCpi7LnYJe3UyvqNQlr35Z/dJmgGmF/TEm5yTvjEGIAcp4sSX48uQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/mT1BwobzAmSXKMJqT3UWTa3C8DBTYxGwu9K90Go5wY=; b=qmNVeKudYMFN8roGVjPh8iJXIbs0+L2exphrQ8GBcVcD7XLuT6ZTQATfqmfM2Pk61StGPJxdyc2Vsov4xZacXsTLghXqoxTht1KqFE1Fm3/VYWJRhtfRdiHHpCoYFkW1UAg9+TbmfNRv9AVN7ML+PkI+bPI2ui2V9SGA5xSAMnCYfvb7PKhcYgeb3npzuF26GjaG6gcaF15rukXkQ+E/s5pZyT+Mr3AMzzXyAu05vAb+S11OzrWYlTEbjUpT0AwUXPIdirffcU2qfdCXqXqA0h+S7AeS+cJr/3ISh6CBbLi+vOwr3TvdtUknMYuC9SZR8dm1GL7WdIWCFdUw8IeMiw== Received: from BN9PR03CA0796.namprd03.prod.outlook.com (2603:10b6:408:13f::21) by DS0PR12MB7704.namprd12.prod.outlook.com (2603:10b6:8:130::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.30; Thu, 30 Mar 2023 05:53:14 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:408:13f:cafe::2e) by BN9PR03CA0796.outlook.office365.com (2603:10b6:408:13f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.20 via Frontend Transport; Thu, 30 Mar 2023 05:53:13 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Thu, 30 Mar 2023 05:53:13 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 29 Mar 2023 22:52:57 -0700 Received: from dev.nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 29 Mar 2023 22:52:56 -0700 From: Chaitanya Kulkarni To: CC: , , , , , , , Subject: [PATCH 4/9] null_blk: check for valid gb value Date: Wed, 29 Mar 2023 22:51:58 -0700 Message-ID: <20230330055203.43064-5-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20230330055203.43064-1-kch@nvidia.com> References: <20230330055203.43064-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|DS0PR12MB7704:EE_ X-MS-Office365-Filtering-Correlation-Id: 32b6cc0e-9cb9-45d4-5737-08db30e30d0a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eCu6r8PgatjV6Vk521+3ECvHvcuqTwM07COtQNDGypWfie7lyZxCbYfjuJbLmp9DKQCZYI1o7b45WEH1l+d7i32aFcDYQREvmUK0OebTxZmK7jYXwqQfoSOYjiglQO9+veH7c8IyAzPhYCd9KjyyscQob8JDDQ9NvE2IMDpp49IcUtXQEgWmxFxQ3xiXDlZY/SOIH2gNqVCfjtIyONv0fJLf8RrJNPx/Z6x0GBmfioBJ8rDDfe03/zoE6XONXWXpmjGCZ0KttZtpXsJHwt1scRex7CXDTjjXssdosBw34iNzs3sCJQZN2MketHvx6E0hCaWYIlJIx5mkhNEPpSxDpgy1QoUJ/FHzzMTvqU+MEb/gYVYmqmp/DJ+s0Ze7oJMXCTwYPPKGe0vDvyfK+JZrVntSM8+mntCdPFTpSUlaQhf599ydilLIFijBIozJQefCegZdvo4kyjnQJsZ8ZTFUfrflClOAyjDXhEdcTFt89FPFE/CFNCfCNldvtGXvfc5b42qE3RclpQ3S70eryg58nyZhaUGpSqLsIuYYkeyPysSzTf7oqV9+BmvFsMVfFZ/f03Gh8i2VX2yIr9ty3TyEQInZa6jfXjum6bxMBVJIWbINQ4ivtpBUDoDA+rDeL6xeg5D+1u58TZVSfYBhsbHNQkrqfw2r7cWra6fBG7of2H/A5hjEvPGoDje7pINp+uSj0IQgh+eUtqKYaQj55NL2JHefpVTJD7GeV9OxUSvV95xqUBL9QcE5s7aPRkCRttVU X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(346002)(136003)(376002)(396003)(451199021)(40470700004)(36840700001)(46966006)(26005)(16526019)(41300700001)(426003)(1076003)(40480700001)(186003)(7696005)(83380400001)(2616005)(336012)(47076005)(478600001)(54906003)(316002)(36860700001)(40460700003)(70206006)(4326008)(70586007)(6916009)(8676002)(2906002)(7636003)(36756003)(82740400003)(82310400005)(356005)(5660300002)(8936002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 05:53:13.5516 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 32b6cc0e-9cb9-45d4-5737-08db30e30d0a X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR12MB7704 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Right now we don't check for valid module parameter value for gb, that allows user to set negative values. Add a callback to error out when gb value is set < 1 before module is loaded. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 2d24c34ec172..51aa202159cb 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -165,8 +165,18 @@ static const struct kernel_param_ops null_queue_mode_param_ops = { device_param_cb(queue_mode, &null_queue_mode_param_ops, &g_queue_mode, 0444); MODULE_PARM_DESC(queue_mode, "Block interface to use (0=bio,1=rq,2=multiqueue)"); +static int null_set_gb(const char *s, const struct kernel_param *kp) +{ + return null_param_store_int(s, kp->arg, 1, INT_MAX); +} + +static const struct kernel_param_ops null_gb_param_ops = { + .set = null_set_gb, + .get = param_get_int, +}; + static int g_gb = 250; -module_param_named(gb, g_gb, int, 0444); +device_param_cb(gb, &null_gb_param_ops, &g_gb, 0444); MODULE_PARM_DESC(gb, "Size in GB"); static int g_bs = 512; From patchwork Thu Mar 30 05:51:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 13193403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EEB7C74A5B for ; Thu, 30 Mar 2023 05:53:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229453AbjC3Fx2 (ORCPT ); Thu, 30 Mar 2023 01:53:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbjC3Fx2 (ORCPT ); Thu, 30 Mar 2023 01:53:28 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2076.outbound.protection.outlook.com [40.107.220.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 039D0110 for ; Wed, 29 Mar 2023 22:53:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gVrHMoN4aHD96g2U2yJ59on5VpCRk+XSDfOIgNZnPBoSR+Nc5ss+zFDAuxIJCwij6wlHKndTyJkW5dZelkgn+mFJEhwp7gU+dGZXpfh/jbDEr7+hp+Q2qeF+oM6Hui5/3aJyL+C6gRn60ChNOyEuimXZVwHCqBgYFaNqNg2+jFxIKwuQpVT9f9anzH514UH0SgHpvOj5IC8+CCzTE2o0/66Mqeh8nmbPtAht+DeE94PKuUW4eV+hIdXmooDIRKaZiIxI6zxwT7KpCi6KyWxy2MwqUx8UbofhcLcWF3iJbIKA6WB52Ev1rwUKbk3nehH1xlMd3iHSWdKQ4TNgNsz7Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/G4oWHzfWdkCLjry2SufGbdC/qY6JdAgZVgdGbhmB0Y=; b=Zg5945JiMFfhbHMnCuy/YWr/yjEbfPkxgttqkzO57l283DeMgtQCuAVDZ88RgV2uQp92shkhekB4hfbcrtaQDxnGKfsdLE9BCjzhgUkP6aB4mZlsMHpa6R5gTFbdW4XJAVLiitDoXPwqin4YKy/SbMHWkI7sw5JXeiZ1BLh1iwlOjZVvAobybEZBTyh8N5yRkUUSBLeTqR686IxvCGJejyd/e9rS7YJHCFWC/wRhxHns9oGqVW67pOJp+Vac1WnxfEi5swjYqFMdPUOxHlHYsNnbeR3Ss+ORP3i+QMXdrv2pMGmrf4+1rvfw2qE6C8aXLBWsZw5Pf4DlC0DGr0JuUA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/G4oWHzfWdkCLjry2SufGbdC/qY6JdAgZVgdGbhmB0Y=; b=VOfcM2448hm4pFzPMe/QJP3WNZPesoeRFVEsfdmUO7EFwp9Py9hyOqcXwmpyQCW6/KrI+YwdqvYVfXd+oGdhpvb0K6kMZnuKt3dUy9bL97pryEssss/hci5sCW1X1+jdPHQLhXpoHAxn8l92F7ez0K121hji2CrO0C8ilAOCc02ehTt8yx/H/YCbrMxBnjwKxIpAPLHDev7qapscrwBqqLoTdKcLeWSJinlFqoAyaKt5LVNnm1QqT4kdJdvTpPjD2Z1ZVSxo5EEjh1urF0ebFH36xBQWIRC+brPEU2H+TTTZWBzs/8NzU3o5Xf/fgwAUZdQX9Z49lO4UCQ4pWgDI/w== Received: from BN9PR03CA0802.namprd03.prod.outlook.com (2603:10b6:408:13f::27) by CH2PR12MB4200.namprd12.prod.outlook.com (2603:10b6:610:ac::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.35; Thu, 30 Mar 2023 05:53:24 +0000 Received: from BL02EPF00010208.namprd05.prod.outlook.com (2603:10b6:408:13f:cafe::3f) by BN9PR03CA0802.outlook.office365.com (2603:10b6:408:13f::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22 via Frontend Transport; Thu, 30 Mar 2023 05:53:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF00010208.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Thu, 30 Mar 2023 05:53:24 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 29 Mar 2023 22:53:08 -0700 Received: from dev.nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 29 Mar 2023 22:53:07 -0700 From: Chaitanya Kulkarni To: CC: , , , , , , , Subject: [PATCH 5/9] null_blk: check for valid block size value Date: Wed, 29 Mar 2023 22:51:59 -0700 Message-ID: <20230330055203.43064-6-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20230330055203.43064-1-kch@nvidia.com> References: <20230330055203.43064-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010208:EE_|CH2PR12MB4200:EE_ X-MS-Office365-Filtering-Correlation-Id: 8fea967d-8658-42aa-4a6d-08db30e31351 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: XuDL5qjJOcnR5Y2qrYWusJ9YJQNutRNBInSb4S1D9tEGmPQ5hDA2YKZ7ZL+IThVX3yAmLuVSiVDZChsgnXFP/MqaLj+gCC9+uip68dTo5f6J8aHrAAuJYUJB0nRGdC9sNjusb4nsGee+x30qwyCZj1Bpe+Tlz3scnFhv9rrnscIvrH4oaxljYjEXblCaWuOMMAEFCaabD3nHXpk5lBy+VYeMdRx1wWgoudlPAsHlxZL39d4cV7t9NI1l5ME44YOoysCd7x6aoS9stHfsB1gOA2KgQ8E+PQYukm+FAHYL8qp59lkr3y1sUBiON5wiv4+8uMY3rWeS8yLE+7kE760iWjoRWxyyMZ21gNVgn4BL7ApjCfKP2Ar85pszDWAyXATb3WL3u9X/qTA6dUUCUdPwWj4VXrKmvjeuZwKveqYSjaKBi1eb6ttPHoNIvgrMSaOSN//BRZqZqupYJCiR9TvS0kYiAwQ6f5D3UOhmeutyWghruc8vZSQ1ieos5g4G8IL5k0zKYBh7eEYZ1L2MVOScjCYNtZGDCs3Ae11C1KJqQui79xcoVJKP3sSgbJoTL1vW65oYTBA/j4JlURqJgH/WMDt0ZSULnLTH1nnpWR/kYBV4QtKFs5SuVUaP023koj8cnewBlaPFRORSPGI49yd04JFVHDKhxAcXlplGTzxzDbtG4rz3UX6zlqDF7dM0992XhYO9VtRzbbqQJP0wHMKDgdez2TcpSem/L7MBDJpS7wj71jBeFFDvxwKW+CuUFN0V X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(376002)(396003)(346002)(39860400002)(136003)(451199021)(46966006)(36840700001)(40470700004)(6916009)(26005)(1076003)(6666004)(356005)(82740400003)(7636003)(336012)(2616005)(47076005)(36860700001)(16526019)(186003)(426003)(5660300002)(8936002)(2906002)(40460700003)(54906003)(36756003)(82310400005)(478600001)(316002)(40480700001)(41300700001)(4326008)(8676002)(70206006)(70586007)(7696005)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 05:53:24.0829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fea967d-8658-42aa-4a6d-08db30e31351 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010208.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4200 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Right now we don't check for valid module parameter value for block size, that allows user to set negative values. Add a callback to error out when block size value is set < 1 before module is loaded. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 51aa202159cb..8f7c6f8c2132 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -179,8 +179,18 @@ static int g_gb = 250; device_param_cb(gb, &null_gb_param_ops, &g_gb, 0444); MODULE_PARM_DESC(gb, "Size in GB"); +static int null_set_bs(const char *s, const struct kernel_param *kp) +{ + return null_param_store_int(s, kp->arg, 512, INT_MAX); +} + +static const struct kernel_param_ops null_bs_param_ops = { + .set = null_set_bs, + .get = param_get_int, +}; + static int g_bs = 512; -module_param_named(bs, g_bs, int, 0444); +device_param_cb(bs, &null_bs_param_ops, &g_bs, 0444); MODULE_PARM_DESC(bs, "Block size (in bytes)"); static int g_max_sectors; From patchwork Thu Mar 30 05:52:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 13193404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DA3FC74A5B for ; Thu, 30 Mar 2023 05:53:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229889AbjC3Fxj (ORCPT ); Thu, 30 Mar 2023 01:53:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbjC3Fxh (ORCPT ); Thu, 30 Mar 2023 01:53:37 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2041.outbound.protection.outlook.com [40.107.244.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B12B85B8E for ; Wed, 29 Mar 2023 22:53:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nGrcROSnJpcD7ckDzM5OFeVvAYINmOn7UxazVFYcjfxqxgAJKkx4iaygfHtpGimtHKX+P7KzQFglBOmkTQV6n5pPX2TEZuRO752aor8efDyH9QrawbRO3WEM+0u6xZ2XUTJaBOWxOmbsEiRn81b+BUo2v7nDNQv3MPA7Lw8mOaXcpk8/naA1sE/PF3POndVKfk3RWXfvg8ny8fU3laprl/y+d7sKsswgC+Hnce9yzmJbL3Yjca/+cKWgIJZsR8XPxqgOHW9/vGEFFRR4JCD9NklgXtX0tKRCSL6bNaykdjMKRCLZZiWr0qHHizaystzjtryfTXBpdk5aCxeM+23sYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0k8xp7R7h3I2FMVIW/rtUk+G3sJrYQqOyYYmN5ZpQb0=; b=QMef/poC9LEWjZ36TAunEy+raBhBHYiklRttTJP8HlT+U6VCQ2xT7tBPIdnUPY6BUAhOA1BeoMzuRmKaXtk9DhvYhAysSXjzbNiYTFmIZyjn9vL3mDK0TvySqBt9r47nbpXSqxylXNn8VeZQISZcSAcOSFazN+ACLEdMltPN7aTglYBTbe+6vAz9klmcm3pEVQyYxVAsoLqiLfYKcsEFjbeikEaX0o08ppzDqWWHxe+NR4IBCOa2Zpepdsm9Xs9bSzNpHaFd35xhYernLMfbM015iPHyVW+dVUjUgoJicOtKDiH7HlewQe017uNn1YoBZmSlEZ2XsTlbXPhNgyT6UA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0k8xp7R7h3I2FMVIW/rtUk+G3sJrYQqOyYYmN5ZpQb0=; b=pv3Ee5ZPnUXHzG6E8Z3qNkVhsHo9KgwZOfde+Vke8BaKw/N5E5hjKy0bpbU2b4mY8IHnZkA/snnGSa+eAankMA2L3OKI0PVLbMMq4mP5TtcRJDTdiu3uCLdO03Kz7XeXE/FWw1MxXQSYT6i6YXOlIcd9wiXtltqgH63bxuFY19egMFa4bq5LOWpEIsVuQ1Y0pbnH6ItytDwxzTthrvq5F/I7uJRVZXoDM0WruoVN1noKgMy1xRjjLYoMzROFtYR7lcpEkF+QJtHwHdf2fUsRWIn0Hqiam2Xat6j5f9XzMFmzu0PD5R0NJCKyvZOPpZ9NiinpKQidyJ4O3CLmzlvgvg== Received: from BL1PR13CA0126.namprd13.prod.outlook.com (2603:10b6:208:2bb::11) by BL1PR12MB5364.namprd12.prod.outlook.com (2603:10b6:208:314::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.22; Thu, 30 Mar 2023 05:53:35 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:208:2bb:cafe::3c) by BL1PR13CA0126.outlook.office365.com (2603:10b6:208:2bb::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.20 via Frontend Transport; Thu, 30 Mar 2023 05:53:34 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Thu, 30 Mar 2023 05:53:34 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 29 Mar 2023 22:53:19 -0700 Received: from dev.nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 29 Mar 2023 22:53:18 -0700 From: Chaitanya Kulkarni To: CC: , , , , , , , Subject: [PATCH 6/9] null_blk: check for valid max_sectors value Date: Wed, 29 Mar 2023 22:52:00 -0700 Message-ID: <20230330055203.43064-7-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20230330055203.43064-1-kch@nvidia.com> References: <20230330055203.43064-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|BL1PR12MB5364:EE_ X-MS-Office365-Filtering-Correlation-Id: 00151d83-0153-435c-791b-08db30e319ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YGOg2I4Ie2BGFVat5ygMpokFIj7drthEqgL2w8ate7YMfthxYiHgMnzJpRhihf9qUEgLxgOZ4sszIY4mwNalJCQ05JpvHdgsATb0YIoJnhRCw787PM8rAQ6aNRUOBW/edjNa8f0m3xTk9iZXllWr4GUfR3W/Gke/A191mOkVGlvnwdN+fl9p/p2paTW8GBYiUlbiJKyROBgsWnDvP7AA838VJtcUi1fo28uRCG8qtXXrGR6NzOYPuplXdwKF8T7Cz7yEKJZ0JnUlQ1/BHIQiNy+s3L8BVD9sxGThx8pe66OFlweLWa7b7Y8rAcrN15KAn6IMtOVZs+YM8pJW1Ju7PMcW87D/3Q1/ax5OxUJ1tyQF46AI2HJhVK6yWRNUzPEweRhRnReaAB0ASpsRNjFJ1dhxz+IUhhTweqZXsyxVyJe2XLcOTCgu6i0dUIyEuATDfjvv2yYe1tMj8IQc0Tpgeb9HO/N2kZ7PX/oajv9m4LZP7HbPH8ZasxFIIZonTrDW5QdfVlFPwG0KpfL6iKUjaRxgX5R4ClLW1bbSYMWtpGpiqGap4T0sKVMI8GKvWJOPsSPuqd0njY4Zeog9p4KJigcmZq5DyxnlYcEYF2wT7BcwawfJaPgMYaHuM1vrZsMOJTlw+tWBv3oML/4UIK9dReWbbvrxK3gX2+zVg2CkyTgFZBcLcajUvazmBsGPvmESI6LGNGUC9kRMXf59JFUlGgSout6TXu+1sGhTWONXQDX6a1qzriNI+aSxYq+IqMMz X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(39860400002)(376002)(136003)(346002)(396003)(451199021)(40470700004)(46966006)(36840700001)(336012)(47076005)(2616005)(426003)(82310400005)(83380400001)(36860700001)(1076003)(7696005)(478600001)(16526019)(316002)(186003)(54906003)(26005)(6666004)(2906002)(5660300002)(40460700003)(36756003)(7636003)(8936002)(6916009)(356005)(4326008)(70206006)(70586007)(8676002)(82740400003)(41300700001)(40480700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 05:53:34.7535 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 00151d83-0153-435c-791b-08db30e319ad X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL1PR12MB5364 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Right now we don't check for valid module parameter value for max_sectors, that allows user to set negative values. Add a callback to error out when max_sectors value is set < 1 before module is loaded. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 8f7c6f8c2132..38f2c7c83de0 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -193,8 +193,18 @@ static int g_bs = 512; device_param_cb(bs, &null_bs_param_ops, &g_bs, 0444); MODULE_PARM_DESC(bs, "Block size (in bytes)"); +static int null_set_max_sects(const char *s, const struct kernel_param *kp) +{ + return null_param_store_int(s, kp->arg, 1, INT_MAX); +} + +static const struct kernel_param_ops null_max_sects_param_ops = { + .set = null_set_max_sects, + .get = param_get_int, +}; + static int g_max_sectors; -module_param_named(max_sectors, g_max_sectors, int, 0444); +device_param_cb(max_sectors, &null_max_sects_param_ops, &g_max_sectors, 0444); MODULE_PARM_DESC(max_sectors, "Maximum size of a command (in 512B sectors)"); static unsigned int nr_devices = 1; From patchwork Thu Mar 30 05:52:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 13193413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1320BC6FD1D for ; Thu, 30 Mar 2023 05:53:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229735AbjC3Fxx (ORCPT ); Thu, 30 Mar 2023 01:53:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229910AbjC3Fxw (ORCPT ); Thu, 30 Mar 2023 01:53:52 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2069.outbound.protection.outlook.com [40.107.93.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04CDD1BE1 for ; Wed, 29 Mar 2023 22:53:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NGZTDoL1i6CMM9hrE8g+WMqD3XiOQ7W5Izse+16/grUZHDLazWROXbc83f6AOnDv1DYv34Moay6UJHYUNoFLqZK57FpUNy2FgHIPfJIIkMkkojs7Okw23h8F1xDdvYm/I3Ki6Gi21ysYKMDtd2rctf+BaspMXosxKBSVGkeWug7a4jHk5o92MgXXYJpTQglCwMYEwv6Tg9xVz1MkXD/SwzhWzWPi5KPRdMcI7GZz6ghns+80lP8XeBMvub6zbCU80LwQ/OQzqPJkAgi3MWon6DkMPxhZQXGTT1nGfrTFqz1SakJGPlGMP/WYJDKICMDRxtpc/4rlnMrpeb2IePPNKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=LV8H7MvdtRyt0gDumkRj+qTKRPYCxqSd1SvXnDw1Mj4=; b=O1x8LUVMX4txHhSIzzKHSmq0mVzEOXUr+fqLN4LvofhuKvBQpij/53eCn+ZNOGLeoA5Pnu2/spX0oVwbpVjnLKgLSTnXwOa7+wJGI2B2buGkCEmRTJYiwZnOkc8+JVdKaNcqFwp5mjtiuD9dfOInplkvIJMBw4OzBJg84BSldgeGrkNhPSyUkox5EEB4axeIS6vHsdcJYQAnCjNhJOH5loEgTP9+Y12aky2RMhrdTOfM8n/EPBUCfFyROpBE1DvtbmyIpaoutn9OuuYBtG5kzPOzjtC2zzGzUutVEhYpTvhtWH4/15MxK/w26079Lhl0QdK2MH68ZJ2uEwVI7VHFWA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LV8H7MvdtRyt0gDumkRj+qTKRPYCxqSd1SvXnDw1Mj4=; b=eLIDqozCqWukQXchi6bIRlKn5UVnQhVXda3j58OEu7KcJWmUk3yFpeUcFEdcWVtJhs3y3iNC62LCBQCZ8RJy/knIc+CqdJEPttDCfx7inAr/YzVaW3aiEwkLJm+4GSO8wcnjF16GPb6JRixGCs4JmgDCOgIXkwKvaMs65CO0CzGJILBI3Myv5q6xVN4o1SNvXi7Lr7whmSGTRZrjV0XtcZUpKomBVjcRrFtXgAtnymk6z9S9zmuWCNEbblNgIVgioNg9zt1UL/aECBomhhV/mPyS6NlsB8zC5ATdCoVyR3apuUs/e/AXauqaFpLov5SPuP/nz57hfaR9DXeAYyCzGw== Received: from BL1PR13CA0125.namprd13.prod.outlook.com (2603:10b6:208:2bb::10) by MN2PR12MB4112.namprd12.prod.outlook.com (2603:10b6:208:19a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.33; Thu, 30 Mar 2023 05:53:47 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:208:2bb:cafe::1e) by BL1PR13CA0125.outlook.office365.com (2603:10b6:208:2bb::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6277.13 via Frontend Transport; Thu, 30 Mar 2023 05:53:46 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Thu, 30 Mar 2023 05:53:46 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 29 Mar 2023 22:53:30 -0700 Received: from dev.nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 29 Mar 2023 22:53:29 -0700 From: Chaitanya Kulkarni To: CC: , , , , , , , Subject: [PATCH 7/9] null_blk: check for valid queue depth value Date: Wed, 29 Mar 2023 22:52:01 -0700 Message-ID: <20230330055203.43064-8-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20230330055203.43064-1-kch@nvidia.com> References: <20230330055203.43064-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|MN2PR12MB4112:EE_ X-MS-Office365-Filtering-Correlation-Id: 448122b6-d98d-4417-ef34-08db30e320d6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: npoGyIijDPUOS4hIU6Hns6uHZ0Jx6YFC1s/ojTmVSbwFO5aq24qKlwv8RLHySs840j11v9Uo6hYylpPH7fchM2H8GKXGqLbjKYQdNgBK14yDTUprsDSSRkJT6tSYFhDo7uIdY+tafkwNTjBLxYilIoDz6a1fn8FPzQMsNiV4wJCIDNZO+YW1BBX9W01r20Gz/jsf6ZRpG8aThdFeUYGNzZ0eX5VI4Rlv7t8bzOnLlkZBItsIVwhoLrNYN+ekSpB+dllwj43WtxpXDz2R1L6pKyXuk7f5uYtlNGUBtWfyZfj/SY0gxTzeBIAtegqRCM2LsTTUrTSs9U69rluAK2LIW8U3Qt7zgdyK8H9m78ndi5nJaqjoeV7VK6SalyugS//0UHmyQaoJMMFlf11aHfRThnGAU5kAF9XAP+ENV4byi213VJQ4XW5oGlBjrh9BV6UoDXK/UMvBxJhGhR1jN3vUF19mfcuMOoA3EOzoWVc4nNtO//sXZQ+rJlbEh61Rtfb6FkWolX0IV6uZITPCSyr2VerI0I6Mh5ma14p/hBKMlzJeNIBRuh3pSrzzb52CDBRT9CXmHXCcc1pEu/rHzXEUbXpvXABW86smhNEdjAV4ALFIYB4tMQymuY+y2sqB0lXRJoisKlslGmNfaovgZ4e9vqZHOUYqmziMW8mIOIoeJ5zBBLkBos0bCjHaehvqbZafzhJp0Yf05Pnf7DsS9Q2hm7QmtU9gWn8wIa9NN+3ULlcpLrOGliPtQ7lpXXly9wU+ X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(39860400002)(396003)(136003)(451199021)(36840700001)(40470700004)(46966006)(186003)(16526019)(54906003)(6666004)(316002)(1076003)(26005)(336012)(426003)(83380400001)(47076005)(2616005)(7696005)(82740400003)(40460700003)(40480700001)(7636003)(82310400005)(8936002)(478600001)(5660300002)(4326008)(70206006)(356005)(41300700001)(6916009)(8676002)(70586007)(36860700001)(2906002)(36756003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 05:53:46.7848 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 448122b6-d98d-4417-ef34-08db30e320d6 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4112 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org Right now we don't check for valid module parameter value for queue depth, that allows user to set negative values. Add a callback to error out when queue depth value is set < 1 before module is loaded. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk/main.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 38f2c7c83de0..2834036f89c1 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -243,8 +243,18 @@ static unsigned long g_completion_nsec = 10000; module_param_named(completion_nsec, g_completion_nsec, ulong, 0444); MODULE_PARM_DESC(completion_nsec, "Time in ns to complete a request in hardware. Default: 10,000ns"); +static int null_set_hw_queue_depth(const char *s, const struct kernel_param *kp) +{ + return null_param_store_int(s, kp->arg, 1, INT_MAX); +} + +static const struct kernel_param_ops null_hw_qdepth_param_ops = { + .set = null_set_hw_queue_depth, + .get = param_get_int, +}; + static int g_hw_queue_depth = 64; -module_param_named(hw_queue_depth, g_hw_queue_depth, int, 0444); +device_param_cb(hw_queue_depth, &null_hw_qdepth_param_ops, &g_hw_queue_depth, 0444); MODULE_PARM_DESC(hw_queue_depth, "Queue depth for each hardware queue. Default: 64"); static bool g_use_per_node_hctx; From patchwork Thu Mar 30 05:52:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 13193414 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A11B7C74A5B for ; Thu, 30 Mar 2023 05:54:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbjC3FyD (ORCPT ); Thu, 30 Mar 2023 01:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229908AbjC3FyC (ORCPT ); Thu, 30 Mar 2023 01:54:02 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2076.outbound.protection.outlook.com [40.107.92.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C329255AA for ; Wed, 29 Mar 2023 22:54:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HU0M0d2JdTIdMVoBmaovMydACy3+jj4XUc76b2EsoxK6dGZZvbwRyT+fr850MWXErW2pyCW5oMUSbc+EXbFixKPU3lyQJQhP7IbiGBqqEJbmbokryRmAJnrwOTE+2IGUZTCMSqQKjFyQ8BqIg84WTdfd+pd91mMyLzfasRB5Dl3NI3Q11WSdot/U2SfKHIxtZWf3WI0Bo3ijbhVZxszTOJrgdlMu+CuBBWtBn6Y3701jA8opVe7VJ1FQYEIj1uMwtIkb1lk6JigzoU1pIxvePRzTmFISLcAvhx7YPGBXMxpXiqhOa1iu5AhfCjjGbN0ugAqPzgkRppOlA57TDt4BLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=BZoICB0NuNWZGylQ8pVNv9jlFfjiN8k+DzzM4tk2+XI=; b=Zzb6L3hnbJvg87NtjTh3wTGOmEuHmVJEku+54X2YliI8CwEPNQjevfXfoPcaKtpfV3ii9LNtLfVg1SfUwYkTYphFimi5kVWwc0skr78xMSxcSiCYUSig9SbO6aznbtqDZRAAxTKDTV6PGo7yosGV4B+v/3MLiSTKpX7/0Q85yBFg0Na5JgrS9HA+ICyyex3kqR47EwQZwu9iZB5z45ZmnrLJN3k41l2wCGqWdwWPSS8YogKR7aJc/4q8WCK09aZ3xKJIlFXu4xRWB43F1/hnAnG5Qo86HuUkZSYH7eoyWOl6PSB1HG3PZWfGBc4EYmc7vaINR2Jlmcb6tNRVPI3maA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=BZoICB0NuNWZGylQ8pVNv9jlFfjiN8k+DzzM4tk2+XI=; b=RwOG84ia+YBrRw2A1fJyMf7wWzPd0GZ+IMvf3We4yOoI3p8daqdix3xAoJRdu3kyI31458un5fWLtdLVOcZSV4VxngFFLbV1k5ZlRVMNDkqgfV8F2TjeZLMHHAsg1EmOkZ62QOPzUHq1ZyKbb3Iq7q8by2M21XCgwjipan7RA2VozVv7h+0Je7yI7qqYR42Cw28I2B7E7Lcdw18f+pFkXfRtiPZ4W9Ev4TL7EA6w5md/3UMFrc44TmLU6HS8GHKkO/HIDwbUeS9O97L3VpAPEY+5ddor+CdYPPiwXrIy7a03BkAY75qIAB36gGWOlYCApQJaf8YfI38k/gDyJC8Xtw== Received: from BN9PR03CA0721.namprd03.prod.outlook.com (2603:10b6:408:110::6) by SJ0PR12MB7458.namprd12.prod.outlook.com (2603:10b6:a03:48d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.20; Thu, 30 Mar 2023 05:53:59 +0000 Received: from BL02EPF000108EB.namprd05.prod.outlook.com (2603:10b6:408:110:cafe::73) by BN9PR03CA0721.outlook.office365.com (2603:10b6:408:110::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.39 via Frontend Transport; Thu, 30 Mar 2023 05:53:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF000108EB.mail.protection.outlook.com (10.167.241.200) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Thu, 30 Mar 2023 05:53:59 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 29 Mar 2023 22:53:42 -0700 Received: from dev.nvidia.com (10.126.231.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 29 Mar 2023 22:53:41 -0700 From: Chaitanya Kulkarni To: CC: , , , , , , , Subject: [PATCH 8/9] null_blk: avoid use global modparam g_queue_mode Date: Wed, 29 Mar 2023 22:52:02 -0700 Message-ID: <20230330055203.43064-9-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20230330055203.43064-1-kch@nvidia.com> References: <20230330055203.43064-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.231.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF000108EB:EE_|SJ0PR12MB7458:EE_ X-MS-Office365-Filtering-Correlation-Id: e8c92889-6308-4a55-3f07-08db30e3285e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EvYe4jZ0rXP+O2B7VmclEVyaPGsnsVO+oPlhxqMfWiinxLAvDEMYdxhibvy8gg/KzaQwfHlgW2/jJYqmhpyanzVVZ6goEXYJ3UoLUJ5q82m/hrt/u066xGRlsYVJgvEcxRCsvLg1i61ELETwith1u7kZ19npi0mKoSxDH8djrRnOHOBKKxi4IgZewN/X+JZkcegyEUMP8Vp2sAX6vB+FedrmHGdpAJbiOmLsh/Ji21YIpQYVyi+hFIbvpCj7tq0UZsnWfBIEchagT2Btnzqso9hVmKdy8CdRH+hsD2rAhQORaWUlXSurqf46dqc8yIDEcKKNZUz/af6+6dop8rPAVIMR5FIT8niE2CcwOCoIMu/gTP3W3iRER+01tpaJw6ZcI0zX3HGE+sWlxcMP6XhPV0JRXXjS/TQy9c6kXcszF1b2lMTzx+lNk3HGGhsW2dS5OH2FZTmX7lfBOA4lsi2Gwc8ntPaiiBfohhv1/evMamBph+dTWC8tDH92TzzErN17WNgx4ttRhx5t75EN2PPwNRyGMpDZXzTB2WQPYdOG7Tdq8oEWbXDDDhz9cJPAmdqJAE/ryYcD4wiI490ZJ6RMMYMv+oFEERSmSCX7jex637Beb4Bz0P1ieEOJnCBeOb2sCzJt3TdbUsxto0lnV2RgLvi8R5sTHVVakKvEDlRVrawZXs9kxfiOW7J6xTuziSel9UV8jQp4kAyRHwPr+Fj8lXJ5bpQcdGRAdU14KqZbfaYZQQVAMcGasMn82Mv3w6jO X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(136003)(39860400002)(396003)(346002)(376002)(451199021)(36840700001)(40470700004)(46966006)(83380400001)(426003)(47076005)(336012)(2616005)(1076003)(186003)(26005)(16526019)(6666004)(478600001)(7696005)(4326008)(36860700001)(70586007)(70206006)(41300700001)(316002)(8676002)(356005)(7636003)(6916009)(82740400003)(5660300002)(2906002)(8936002)(36756003)(82310400005)(40460700003)(40480700001)(54906003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 05:53:59.4001 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e8c92889-6308-4a55-3f07-08db30e3285e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF000108EB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB7458 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The reference to module parameter is already present in the struct kernel_param dp->arg include/linux/moduleparam.h :- device_param_cb(name, ops, arg, perm) level_param_cb(name, ops, arg, perm, level) __module_param_call(prefix, name, ops, arg, perm, level, flags) 288 /* Default value instead of permissions? */ \ 289 static const char __param_str_##name[] = prefix #name; \ 290 static struct kernel_param __moduleparam_const __param_##name \ 291 __used __section("__param") \ 292 __aligned(__alignof__(struct kernel_param)) \ 293 = { __param_str_##name, THIS_MODULE, ops, \ 294 VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } } Replace global reference to the g_queue_mode in null_set_queue_mode() with the function parameter kp-arg and rearrage code that matches nicely with this patch series. No functional change in this patch. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 2834036f89c1..69f2d68ba14f 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -150,11 +150,9 @@ module_param_string(init_hctx, g_init_hctx_str, sizeof(g_init_hctx_str), 0444); MODULE_PARM_DESC(init_hctx, "Fault injection to fail hctx init. init_hctx=,,,"); #endif -static int g_queue_mode = NULL_Q_MQ; - static int null_set_queue_mode(const char *str, const struct kernel_param *kp) { - return null_param_store_int(str, &g_queue_mode, NULL_Q_BIO, NULL_Q_MQ); + return null_param_store_int(str, kp->arg, NULL_Q_BIO, NULL_Q_MQ); } static const struct kernel_param_ops null_queue_mode_param_ops = { @@ -162,6 +160,7 @@ static const struct kernel_param_ops null_queue_mode_param_ops = { .get = param_get_int, }; +static int g_queue_mode = NULL_Q_MQ; device_param_cb(queue_mode, &null_queue_mode_param_ops, &g_queue_mode, 0444); MODULE_PARM_DESC(queue_mode, "Block interface to use (0=bio,1=rq,2=multiqueue)"); From patchwork Thu Mar 30 05:52:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chaitanya Kulkarni X-Patchwork-Id: 13193415 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9B31C74A5B for ; Thu, 30 Mar 2023 05:54:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229908AbjC3FyM (ORCPT ); Thu, 30 Mar 2023 01:54:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229834AbjC3FyL (ORCPT ); Thu, 30 Mar 2023 01:54:11 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2086.outbound.protection.outlook.com [40.107.220.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01BEC12E for ; Wed, 29 Mar 2023 22:54:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BIwG5F0+HwGXdWMU2TEk/BLNqkj3C+6l1yvzIe8W6ETcg8KQ9vhdJvFtnlsZPYiJrp5TM7IeoiI+U2QiLVgtjSNBDSn5hq9PQUbo8WsAbSDSoc2fW6LnHk7NEoGIzWcM4WhRmDpsH20R78qePXSyj2vkqZvB489yO9GjBBmsnQnFEfg8CDhgEhnTbddn5k3X9YO/IqvTGhCIFi/fWNcd+RulUmaRB9c8mvwcGtYJYCR9p5+Lvk1cF4CvQFJhIYVrDqJozdMYhWG1H01nhb2b3T6ntHNBSBFSqhH/DHBIatebjQvdMbbEGVC4bzxYR3YXqasttKthugom86CtfAGshQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=GDhgR9ciMwYN5p6yHq5NBEP+4xQJparSApHfdZbJnws=; b=UzbcMfmAbE9+A/aG0LKZIVekghRDe33g0J6cbakt0KpOt4GoDUJdG6yHwmvOYeTe2NuScOQQT8/tepya+Ua7HQgFpDGulxRvcyHVUTI51qkF+v+DUI4ZGnuT3YUi2lpBuZA50k1dS5daATiS++WPSV9/CTJWgwNyruxPCOfDUjl96dAeotZm48Ghb0cVh3GvWjI71gqHfbYVI0HZ17rdtsBYHW5/04EwkdU+Js8F+QgDWP49e4ZsvqyCHV2ICUaOli3lnrpsBnhmbpfIF6mFkLxIi1iNgqXtOCq3P23LW/w875kl5uCDWILAuqXdQHzRRd9QZrJgtgaDFmakDvKClA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GDhgR9ciMwYN5p6yHq5NBEP+4xQJparSApHfdZbJnws=; b=NgTEsymHUWP4zWyUMpP1Qbuy7oP/huX5ONn9blO7qCR4iO2yx5J0FhTHVpGtCVqk08cDiSrHnomK/5USZlJ33afD9VetAwZqPzj0CWKhqzL7RgKHJrVY7jWtYPOx8QKiwUK/Gui8S2HmN39KPK+Mo6HfXLx7j2FSoQ0Mx/49VDFAn7WQDsplWquoRYx+66gzKdJ2WRVjuioDVQv+DCrwPozIAWY66N/ojwGvM/Gm4nDVaDI/MumIkNuof2Z0fU3E2SnBkcujjJ13TeOLkuwZAQjgjWJumshgECBa1f9o+b5GQTOAKxDLm+vBIDT4vXdWGKP8zT7kBQVZSRMx/tUYdQ== Received: from BL1PR13CA0131.namprd13.prod.outlook.com (2603:10b6:208:2bb::16) by SN7PR12MB8819.namprd12.prod.outlook.com (2603:10b6:806:32a::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6222.35; Thu, 30 Mar 2023 05:54:08 +0000 Received: from BL02EPF00010209.namprd05.prod.outlook.com (2603:10b6:208:2bb:cafe::f0) by BL1PR13CA0131.outlook.office365.com (2603:10b6:208:2bb::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.18 via Frontend Transport; Thu, 30 Mar 2023 05:54:08 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BL02EPF00010209.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6178.30 via Frontend Transport; Thu, 30 Mar 2023 05:54:07 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Wed, 29 Mar 2023 22:53:53 -0700 Received: from dev.nvidia.com (10.126.230.37) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Wed, 29 Mar 2023 22:53:52 -0700 From: Chaitanya Kulkarni To: CC: , , , , , , , Subject: [PATCH 9/9] null_blk: avoid use global modparam g_irq_mode Date: Wed, 29 Mar 2023 22:52:03 -0700 Message-ID: <20230330055203.43064-10-kch@nvidia.com> X-Mailer: git-send-email 2.29.0 In-Reply-To: <20230330055203.43064-1-kch@nvidia.com> References: <20230330055203.43064-1-kch@nvidia.com> MIME-Version: 1.0 X-Originating-IP: [10.126.230.37] X-ClientProxiedBy: rnnvmail201.nvidia.com (10.129.68.8) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF00010209:EE_|SN7PR12MB8819:EE_ X-MS-Office365-Filtering-Correlation-Id: 3edcdd97-9e1c-4aa5-b1ee-08db30e32d7c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Od8BQ8ZhW2p6wv6qSzowVgnhEWC+K62S7m3ClBXS31sGOPTeBnYPRZ4iwgZCSMkMKbo4H5kz/KFVU/rQxUC9yBmdY8naLGhFAk/m7RigC11rAQd8RB5n0+gPnu+0z59DfNLWDitGukO605y8qWJ4PM4A7CF25imoaGIrxzZv5XAtGHxZbJbNfXbsDQxs4tr2F75iS9gdoOnVI6eFhJsy3p3rpGBxTjDSldsgDwZCU6xAZPpMUuVbSpU8v0v12ahIqrnIKzNhJSSSQCa2z6ylXrIeZGrwHu1Hp+GfX4yWSgmKdsreNCJexjtNtuFSCiv6Uh1rQ4o4J/rzM8NycTroy9PHgnB7gsxhGDz80AlaaASrveKL9GgDwUNNwC1bKRvMg89kroyRC/0RD34HzOkCNL5+mUenx7h5dIMK0AR3UdIiKQhZi/Q2tJqlwnq4jgBi1z55XB6DU69IAdFin3FDneWw0/2Xolm1SKjyd4jIJp3qW3lO1Py5y9M+7BjrlR+l9UHB61OsTSiwtMZooX+/y+/dEEfxPZzvy5yumwnqaoqAQfgZ7Kxm06aAbBe414fdvUMQrRpPUWPLeUjrAe5FrBWNoi2oVUUe0BC4xJ6zV8zDmjeDIowT9LX+kb7LWUO2Tudzcr92sm08mE8VXpu61gnWLMt2E7+AAE4XxvZxKS94lh4cFs8XhNjcxo1i3X2KlG6gLfNnDiWzXRLlvYytVJaAo0adLNogBAyfQIJk7Wh3iyCJlMtucVx2Ko2OCejl X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(346002)(39860400002)(136003)(451199021)(40470700004)(46966006)(36840700001)(82740400003)(356005)(26005)(6666004)(1076003)(7636003)(336012)(47076005)(186003)(16526019)(2616005)(426003)(2906002)(36860700001)(8936002)(40460700003)(5660300002)(8676002)(7696005)(478600001)(36756003)(316002)(54906003)(40480700001)(41300700001)(70206006)(4326008)(82310400005)(6916009)(70586007)(83380400001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Mar 2023 05:54:07.9882 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3edcdd97-9e1c-4aa5-b1ee-08db30e32d7c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF00010209.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8819 Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org The reference to module parameter is already present in the struct kernel_param dp->arg include/linux/moduleparam.h :- device_param_cb(name, ops, arg, perm) level_param_cb(name, ops, arg, perm, level) __module_param_call(prefix, name, ops, arg, perm, level, flags) 288 /* Default value instead of permissions? */ \ 289 static const char __param_str_##name[] = prefix #name; \ 290 static struct kernel_param __moduleparam_const __param_##name \ 291 __used __section("__param") \ 292 __aligned(__alignof__(struct kernel_param)) \ 293 = { __param_str_##name, THIS_MODULE, ops, \ 294 VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } } Replace global reference to the g_irq_mode in null_set_irq_mode() with the function parameter kp-arg and rearrage code that matches nicely with this patch series. No functional change in this patch. Signed-off-by: Chaitanya Kulkarni --- drivers/block/null_blk/main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/block/null_blk/main.c b/drivers/block/null_blk/main.c index 69f2d68ba14f..d0d7c52b0f81 100644 --- a/drivers/block/null_blk/main.c +++ b/drivers/block/null_blk/main.c @@ -222,11 +222,9 @@ static bool g_shared_tag_bitmap; module_param_named(shared_tag_bitmap, g_shared_tag_bitmap, bool, 0444); MODULE_PARM_DESC(shared_tag_bitmap, "Use shared tag bitmap for all submission queues for blk-mq"); -static int g_irqmode = NULL_IRQ_SOFTIRQ; - static int null_set_irqmode(const char *str, const struct kernel_param *kp) { - return null_param_store_int(str, &g_irqmode, NULL_IRQ_NONE, + return null_param_store_int(str, kp->arg, NULL_IRQ_NONE, NULL_IRQ_TIMER); } @@ -235,6 +233,7 @@ static const struct kernel_param_ops null_irqmode_param_ops = { .get = param_get_int, }; +static int g_irqmode = NULL_IRQ_SOFTIRQ; device_param_cb(irqmode, &null_irqmode_param_ops, &g_irqmode, 0444); MODULE_PARM_DESC(irqmode, "IRQ completion handler. 0-none, 1-softirq, 2-timer");