From mboxrd@z Thu Jan 1 00:00:00 1970 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 8C068C6FA86 for ; Thu, 15 Sep 2022 09:01:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 32C706B0075; Thu, 15 Sep 2022 05:01:54 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B4868D0005; Thu, 15 Sep 2022 05:01:54 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 17EB78D0003; Thu, 15 Sep 2022 05:01:54 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 03D106B0074 for ; Thu, 15 Sep 2022 05:01:54 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id D569FA0CA3 for ; Thu, 15 Sep 2022 09:01:53 +0000 (UTC) X-FDA: 79913727306.22.6101022 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf21.hostedemail.com (Postfix) with ESMTP id 484AD1C00C1 for ; Thu, 15 Sep 2022 09:01:52 +0000 (UTC) Received: from canpemm500005.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4MSrh92LPqzmVPx; Thu, 15 Sep 2022 16:58:01 +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.31; Thu, 15 Sep 2022 17:01:47 +0800 From: Zhao Gongyi To: , , , CC: , , , , , Zhao Gongyi Subject: [PATCH -next v2 1/5] docs: notifier-error-inject: fix non-working usage of negative values Date: Thu, 15 Sep 2022 16:57:53 +0800 Message-ID: <20220915085757.258608-2-zhaogongyi@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220915085757.258608-1-zhaogongyi@huawei.com> References: <20220915085757.258608-1-zhaogongyi@huawei.com> MIME-Version: 1.0 Content-Type: text/plain 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; imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 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=1663232512; a=rsa-sha256; cv=none; b=Ee1Wt/xJfD2qMZoV5F5jmhKaWWs6XWMPxovuqZensTH7iTzL4KT9PdJsTluLKyf6QPFuEx Vut0F4eg9Oe19UyvFNXBWEmclBRSJI5cv30mUAx9D1CmK2/uyJt2ciCAb+brhmHEiQGQ9Q 6EvWMvJ/lwlL286YM3YMZqE/OfuPhq8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1663232512; 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=7TzQVCBqcgNuWDkzqXPmETtsBzHFV2HsKvKC8Vn+8J1KAgbgzNnvIxTjFPaYDLbvWetHKe SQGKppkKFb+2Dx+DdElausxg3bW83oBD8TK26HqNtBIropMsg9VLnDojXg9SjjqwgqXKRh kdwiMXoP9tK0lBmJvSmq4FXtikvLAYQ= X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 484AD1C00C1 Authentication-Results: imf21.hostedemail.com; dkim=none; spf=pass (imf21.hostedemail.com: domain of zhaogongyi@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=zhaogongyi@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Stat-Signature: kx7cagghdcygn69u9mh9whem9b9z3bg1 X-HE-Tag: 1663232512-316232 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(-) 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 -- 2.17.1