Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753288AbdL1DuI (ORCPT ); Wed, 27 Dec 2017 22:50:08 -0500 Received: from mx0b-00082601.pphosted.com ([67.231.153.30]:52268 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753061AbdL1DuF (ORCPT ); Wed, 27 Dec 2017 22:50:05 -0500 Subject: Re: [RFC PATCH bpf-next v2 4/4] error-injection: Support fault injection framework To: Masami Hiramatsu References: <151427438796.32561.4235654585430455286.stgit@devbox> <151427450538.32561.2776225740675148782.stgit@devbox> <20171227021255.sahkcpgyzohl5brs@ast-mbp> <20171227170910.5ac1074bc86341f194130119@kernel.org> <87e5e909-593d-7fd6-c7bb-714c1e3022a0@fb.com> <20171228103849.9be1a4507298b280b9df9c20@kernel.org> CC: Alexei Starovoitov , Josef Bacik , , , , , , , , , , , Josef Bacik , Akinobu Mita From: Alexei Starovoitov Message-ID: <126a806d-e913-d243-6678-56fc3cff5e9e@fb.com> Date: Wed, 27 Dec 2017 19:49:28 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20171228103849.9be1a4507298b280b9df9c20@kernel.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [2620:10d:c090:180::a7a] X-ClientProxiedBy: MWHPR20CA0021.namprd20.prod.outlook.com (2603:10b6:300:13d::31) To BL2PR15MB0961.namprd15.prod.outlook.com (2603:10b6:201:15::23) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ffc86fd0-fe06-4b61-2018-08d54da60217 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060);SRVR:BL2PR15MB0961; X-Microsoft-Exchange-Diagnostics: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nVrhU2x7itI5RhrRG5ZJKchph7urKAV5H249OFqzZTGDjC5rjyrDkn97Mn6H5dI4opEfs8Qi1zGFuNyTvE0+qn9niGlToxe2r/q+nx/YcUGR9VTEKvTGkcoewcqvpXLZOmvyVAh6KTyv1mvQlf9p1yeJHkbbAJq4Ziil59GFPTTL8lDHJKc5fbl4VJin28zD9Uk0YHB4dVRC2gO/CtIJJIO/DeUzN8V2kCS87nF5fZ9SkoPpw4NmP1RLuh9LW8ePNholsJFDhtFJsYMMs0BpNDuMnMGD576a1y/wutfV++3M0wrV98dxrr/u5vIzzOg/60SAoNmBNYQxkHhTg4yrCC7wydBKZ;4:Qd2Jp97n3osFeNlFi4DFC8rYzj6F/b8oP7gneKShz8mfHehdiV2/jTkloDDA7uwfX1nXDJlW0l5YtNv0yS+NALpfsrxMctBZSDfSNgpIcyGJRDRrR+4pc0VlppCMBmi/QwhFaLUNDxIkR/FV8AHfmEelTqYl4L2GyA1hzP7ub+qUXRRwXQruy14cLYV2IvZeOuu2/iMyrHz9y/jPGBxq3HzbDpSZZbMsaw7eN46OydJVg/qCyIDZ26ExhszrlM+B7ZjmQ1DezN+oCnmhoFAoBDk656UAO0YamEk6r1uQOHyhGvPg7ED3Tu/6j3tfdK99 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(67672495146484); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(11241501184)(944501075)(93006095)(93001095)(10201501046)(3002001)(6041268)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123558120)(20161123562045)(20161123564045)(6072148)(201708071742011);SRVR:BL2PR15MB0961;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:BL2PR15MB0961; X-Forefront-PRVS: 05352A48BE X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(366004)(396003)(39860400002)(376002)(39380400002)(346002)(24454002)(189003)(199004)(2906002)(6666003)(36756003)(58126008)(54906003)(93886005)(25786009)(31696002)(59450400001)(386003)(86362001)(106356001)(53546011)(6916009)(2950100002)(83506002)(6246003)(39060400002)(8936002)(230700001)(50466002)(97736004)(4326008)(65806001)(5660300001)(65956001)(47776003)(68736007)(8676002)(81156014)(81166006)(64126003)(7416002)(478600001)(6486002)(105586002)(6116002)(316002)(65826007)(31686004)(67846002)(53936002)(305945005)(7736002)(23746002)(52396003)(1706002)(229853002)(52116002)(76176011)(217873001)(42262002);DIR:OUT;SFP:1102;SCL:1;SRVR:BL2PR15MB0961;H:[IPv6:2620:10d:c081:1132::1039];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;BL2PR15MB0961;23:x/9/l8UlOs3DoQbQ6ZIcJ7NpeZSfwTYWIRa42?= =?Windows-1252?Q?r6IfiPcc1IKoAfYqlwDH87Vdf3/8BFZiSzkLUXMKgdHgI5KrL46HH/dq?= =?Windows-1252?Q?HKchLaOl6gBBvDakPKn8f2wTBhrI1i4d2LWezqLT/Zt/s50GQ8Dmiqf0?= =?Windows-1252?Q?7pKEqo9eKOPKDaZqL9YIXPuEMFfoaXYrozrXMB97dxYgXvhT7Wr9/eFZ?= =?Windows-1252?Q?JnbiGnC/CGNzElrJTSU9Deq3dsrFk0hlLTryHGTEhftdUYjjqa9jg+gX?= =?Windows-1252?Q?1pwOxR5XmVq9A59owji3sZE0sLH8M+yO58PVDQAFVlkZKvtPd9YId9pR?= =?Windows-1252?Q?EocT6OYwVfRMUpbXRyIuv+4W3vZszq1mVUvLJWwLsKWvpYBP4N7CqDJu?= =?Windows-1252?Q?K1oTCKi0V2qQ0Zte96gauLJkIddddTadynagJdB+TOElA1tWNnjddsjo?= =?Windows-1252?Q?xgK7UgWVoMqgooxadppkVrj9t9R5EKBIlPSOK5f1rfs7FiF2pP3ITkDS?= =?Windows-1252?Q?2mUn2zOdD/FCrLW9pszObkFO0f5iB6QJcc9blnCyu0JhM2US4IG8hqmb?= =?Windows-1252?Q?Mw17bMD9eof6+SBN1n7bJDaUjX5Ninh7n33mV8aog7cSnEN1rqZHjxTA?= =?Windows-1252?Q?8FrDri0ITrN3OfZ/W14ByHobyurW2f5UjfLm19vJEa96T4XJCLSrEoAG?= =?Windows-1252?Q?I3+ua8WPvcw0Vm9evAchdr8hhYmWVRigCnfXD8MyYF6lUoVp3qjmHNCA?= =?Windows-1252?Q?hUIMCnizJeJnFhhmbGaqVjwALYsYNmadUVQKsWHZ3cKbu1dxrtEN4XGF?= =?Windows-1252?Q?AslWYp4WvOmO0QUPBmuMnYTyBfrr+V8SB/XmT1796pxHKT/y6D2OsIg5?= =?Windows-1252?Q?XtvTuT9MPmoEHyGllnPDuPLbeHxoAHciB/8KSqmewUTz9Ej/sF8gWvn5?= =?Windows-1252?Q?2VOwASjFMEXUromazzbNu3bYUF9faaErNmFb8lP0hXJyN0bEw/ZK1WGw?= =?Windows-1252?Q?llOY7DwAj+MOHzQ8e9WYM90+b+CUBqVp0rKCIgc1NPbaHbHSe/6mZHir?= =?Windows-1252?Q?xKEwwL+01Evqbj1i8WYylgxC/ng6vNgTUL2c2Ti0P0jAXhHHqeSjVrlh?= =?Windows-1252?Q?SJyMwRyUhKeM2nlG7lCEMqo9mr/AfnTEyKmbUVYtU+8BwxMfd0lTDA1P?= =?Windows-1252?Q?8EUasMwKMLM7h7nwHA/mx/LKc6sHmvl6X/81le+RPO34yi1NLIZX3TBz?= =?Windows-1252?Q?tnDUp90FdP8/X3vTuxJ+xYrNsl+oUXCtP2UIomZCY3C/vLmtSTcw3GlT?= =?Windows-1252?Q?vvWwIBpgUo/Efvti1qJiKaXeiAr4FbaqeiNXvh+aPXv8ufR8t1ulnped?= =?Windows-1252?Q?aOCDmgQ4G47hr+Sh2UCjkzBtO3WMJO0soJAqaLgd4495+ZNye1NkzYpU?= =?Windows-1252?Q?Jc0IC6DTNnuyP+INs/45JvNbCF/8RRzd/esUiH8KaD7H2L1kSichJXSw?= =?Windows-1252?Q?HND2r1d6+p54zviKfVUmOI0tqgG?= X-Microsoft-Exchange-Diagnostics: 1;BL2PR15MB0961;6:Y9ALhqiXPXq2dGLONgYJBaXgD1qUDWSKS8gf8qwsuL5vMlKuvZGIliuVz+O8oe+fUpFwHt6lMbCNQ9uF+oIpzcbz/KwtS52a3Q7By2XhI256SQ/B9XQOK6eTEuY3UWefD1qtlvd+HWr4HRlFE+R03IBFuxpsCwD1kqG70RarbqVx94TwRXXEhgK3qHpmGEJ8rkvbLRGyLzh3+7D057vVhr2xC9rGX4t8OHItI933zzVq5fpC8W9KPXtK/r58s1vt/6tgvF3GvnrLskPG7gtKFUyF43LAbKsW3X1eGdMJjbOt6hTtjguySsgf9JMxmra9e29xsgCjKRPR1iQBX5zHVhqENQG3Xp+wm4bWvW1ZvPA=;5:VKs/Z4Vv1Ethog+yoeMur0QSkknS+DXv/Ganna3J3U+oFXhfWq02jrlABpVj2LPyEj3Xezk+SCiix1hg4Gs40Kti3VgcBHZMa+3PmAdYlXrXZP5JRY/LlTWDmrVT4IJvPO5epoQ3aPVspWt12gL0UJBEJjTlVE/IhWxCbmlUFeM=;24:5jWyhQv/6PlmtCFfZYTfqrLLYCQuEnXMzwFOgH3W9cZvu7qpit9hbqmTOgtD+6c0EY8bfKcjECBBZPhEgxEfBwpVDxWMkLlYXKOYbSYXZVY=;7:eSfE9AZHaVZnPLasvNp4vE+25tnIHxuT8EEt9TgYFDDGVJB/bZS/ZWFVjfJwHQDLU/ruYSQBUt4Q07nAzcydkKYfXDMOoKDRiH86owEpQQTgaJ9ktHra1TB1Z9fTClBicKEFz+87ozQZYg/Dp48vtdytL4g/HDcpevUt4s7dfVtnYELkNfVQuGyXH7yPcvjcOQtnngAq7tp/9BwFmEhwZynnccVjdfD1kyFBwVuQWBBME7OZnNeLhJqXJzXbwiyh SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;BL2PR15MB0961;20:14ttsWQ65uj2TY5abtNXdDZJjxN38KIXWQdk5w7jGXdYhWec6ttZaVOXGwZdtofDWY6qzqESKMlAbX9QFBgsIg+Lj4hkJVQzQHTNrPxQIILQ5t1oPj2mLzh26xRwiamYpoKlJTLotlZaK3SEoOiFLtXm/aWKtucS06lfecRq9Jg= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2017 03:49:31.7616 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ffc86fd0-fe06-4b61-2018-08d54da60217 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 8ae927fe-1255-47a7-a2af-5f3a069daaa2 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR15MB0961 X-OriginatorOrg: fb.com X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-28_02:,, signatures=0 X-Proofpoint-Spam-Reason: safe X-FB-Internal: Safe Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3381 Lines: 76 On 12/27/17 5:38 PM, Masami Hiramatsu wrote: > On Wed, 27 Dec 2017 14:49:46 -0800 > Alexei Starovoitov wrote: > >> On 12/27/17 12:09 AM, Masami Hiramatsu wrote: >>> On Tue, 26 Dec 2017 18:12:56 -0800 >>> Alexei Starovoitov wrote: >>> >>>> On Tue, Dec 26, 2017 at 04:48:25PM +0900, Masami Hiramatsu wrote: >>>>> Support in-kernel fault-injection framework via debugfs. >>>>> This allows you to inject a conditional error to specified >>>>> function using debugfs interfaces. >>>>> >>>>> Signed-off-by: Masami Hiramatsu >>>>> --- >>>>> Documentation/fault-injection/fault-injection.txt | 5 + >>>>> kernel/Makefile | 1 >>>>> kernel/fail_function.c | 169 +++++++++++++++++++++ >>>>> lib/Kconfig.debug | 10 + >>>>> 4 files changed, 185 insertions(+) >>>>> create mode 100644 kernel/fail_function.c >>>>> >>>>> diff --git a/Documentation/fault-injection/fault-injection.txt b/Documentation/fault-injection/fault-injection.txt >>>>> index 918972babcd8..6243a588dd71 100644 >>>>> --- a/Documentation/fault-injection/fault-injection.txt >>>>> +++ b/Documentation/fault-injection/fault-injection.txt >>>>> @@ -30,6 +30,11 @@ o fail_mmc_request >>>>> injects MMC data errors on devices permitted by setting >>>>> debugfs entries under /sys/kernel/debug/mmc0/fail_mmc_request >>>>> >>>>> +o fail_function >>>>> + >>>>> + injects error return on specific functions by setting debugfs entries >>>>> + under /sys/kernel/debug/fail_function. No boot option supported. >>>> >>>> I like it. >>>> Could you document it a bit better? >>> >>> Yes, I will do in next series. >>> >>>> In particular retval is configurable, but without an example no one >>>> will be able to figure out how to use it. >>> >>> Ah, right. BTW, as I pointed in the covermail, should we store the >>> expected error value range into the injectable list? e.g. >>> >>> ALLOW_ERROR_INJECTION(open_ctree, -1, -MAX_ERRNO) >>> >>> And provide APIs to check/get it. >> >> I'm afraid such check would be too costly. >> Right now we have only two functions marked but I expect hundreds more >> will be added in the near future as soon as developers realize the >> potential of such error injection. >> All of ALLOW_ERROR_INJECTION marks add 8 byte overhead each to .data. >> Multiple by 1k and we have 8k of data spent on marks. >> If we add max/min range marks that doubles it for very little use. >> I think marking function only is enough. > > Sorry, I don't think so. > Even if it takes 16 bytes more for each points, I don't think it is > any overhead for machines in these days. Even if so, we can provide > a kconfig to reduce it. > I mean, we are living in GB-order memory are, and it will be bigger > in the future. Why we have to worry about hundreds of 16bytes memory > pieces? It will take a few KB, and even if we mark thousands of > functions, it never reaches 1MB, in GB memory pool. :) > > Of course, for many small-footprint embedded devices (like having > less than 128MB memory), this feature can be a overhead. But they > can cut off the table by kconfig. I still disagree on wasting 16-byte * num_of_funcs of .data here. The trade-off of usability vs memory just not worth it. Sorry. Please focus on testing your changes instead.