From patchwork Fri Sep 9 07:51:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhao Gongyi X-Patchwork-Id: 12971195 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04FF4ECAAD5 for ; Fri, 9 Sep 2022 07:55:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8BBFE8D0006; Fri, 9 Sep 2022 03:55:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 86B9F8D0001; Fri, 9 Sep 2022 03:55:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 733E48D0006; Fri, 9 Sep 2022 03:55:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 66E588D0001 for ; Fri, 9 Sep 2022 03:55:39 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 294331606C4 for ; Fri, 9 Sep 2022 07:55:39 +0000 (UTC) X-FDA: 79891787598.07.43D6B55 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf25.hostedemail.com (Postfix) with ESMTP id 471FDA00A5 for ; Fri, 9 Sep 2022 07:55:38 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4MP7Xf3KXyzHngB; Fri, 9 Sep 2022 15:53:38 +0800 (CST) Received: from ubuntu1804.huawei.com (10.67.174.63) by canpemm500005.china.huawei.com (7.192.104.229) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 9 Sep 2022 15:55:35 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next 1/5] docs: notifier-error-inject: fix non-working usage of negative values Date: Fri, 9 Sep 2022 15:51:56 +0800 Message-ID: <20220909075200.198363-2-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220909075200.198363-1-zhaogongyi@huawei.com> References: <20220909075200.198363-1-zhaogongyi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.174.63] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500005.china.huawei.com (7.192.104.229) X-CFilter-Loop: Reflected ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662710138; a=rsa-sha256; cv=none; b=c6ecu/PPbE83lSfOVxeeWbfY9dgtYT43jJzBz79z7CA0QYAhsX0mPpULZVP2SHOVyXKDlc w4/Wd8sqtlJ0bHkhTc5qjhGrvfK58CG4LHRfafZnfYMtD60nD17O5wCRlcNVdbxzPH69s7 OLUFehQzwWKWjKTewzNLocX55vZsupo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662710138; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FM5FPnNCknRy6kBMjXhRDVq5x0+KPm9flgrZKjcm+5w=; b=3mgMGRp0ehU+sbFqJEwv2liUjCJphlHVkZ2XghZkm0cUu3vBPHNvguNLMxizjmNUptpjRL y6Ol3aqBNxIYk1gdatXYLjfoEWcPD0yUgXeTE4KaF0O6GK0hLfe6hbiJZc9wuHmu1AAvsz ow0BQL3v1femYgGs5UprD7pAEZLSJMo= X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 471FDA00A5 Authentication-Results: imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: zn8ejtucpzyihg398hhd56ksb9zig3hi X-Rspam-User: X-HE-Tag: 1662710138-847677 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Fault injection uses debugfs in a way that the provided values via sysfs are interpreted as u64. Providing negative numbers results in an error: # cd sys/kernel/debug/notifier-error-inject/memory # echo -12 > actions/MEM_GOING_ONLINE/error -bash: echo: write error: Invalid argument Update the docs and examples to use "printf %#x " in these cases. Signed-off-by: Zhao Gongyi --- .../fault-injection/notifier-error-inject.rst | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.17.1 diff --git a/Documentation/fault-injection/notifier-error-inject.rst b/Documentation/fault-injection/notifier-error-inject.rst index 1668b6e48d3a..0e2790122166 100644 --- a/Documentation/fault-injection/notifier-error-inject.rst +++ b/Documentation/fault-injection/notifier-error-inject.rst @@ -11,6 +11,10 @@ modules that can be used to test the following notifiers. * powerpc pSeries reconfig notifier * Netdevice notifier +Note that the interface only accepts unsigned values. So, if you want +to use a negative errno, you'd better use 'printf' instead of 'echo', e.g.: +$ printf %#x -12 > actions/PM_SUSPEND_PREPARE/error + PM notifier error injection module ---------------------------------- This feature is controlled through debugfs interface @@ -26,7 +30,7 @@ Possible PM notifier events to be failed are: Example: Inject PM suspend error (-12 = -ENOMEM):: # cd /sys/kernel/debug/notifier-error-inject/pm/ - # echo -12 > actions/PM_SUSPEND_PREPARE/error + # printf %#x -12 > actions/PM_SUSPEND_PREPARE/error # echo mem > /sys/power/state bash: echo: write error: Cannot allocate memory @@ -44,7 +48,7 @@ Possible memory notifier events to be failed are: Example: Inject memory hotplug offline error (-12 == -ENOMEM):: # cd /sys/kernel/debug/notifier-error-inject/memory - # echo -12 > actions/MEM_GOING_OFFLINE/error + # printf %#x -12 > actions/MEM_GOING_OFFLINE/error # echo offline > /sys/devices/system/memory/memoryXXX/state bash: echo: write error: Cannot allocate memory @@ -82,7 +86,7 @@ Netdevice notifier events which can be failed are: Example: Inject netdevice mtu change error (-22 == -EINVAL):: # cd /sys/kernel/debug/notifier-error-inject/netdev - # echo -22 > actions/NETDEV_CHANGEMTU/error + # printf %#x -22 > actions/NETDEV_CHANGEMTU/error # ip link set eth0 mtu 1024 RTNETLINK answers: Invalid argument