Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp947755ybi; Fri, 26 Jul 2019 23:29:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6g/md47XuebbE2VrHFUM8axM/gwE08tfg8St0fmEbaqQnmk2uq3iFnvpHB/angX8RkRJc X-Received: by 2002:a63:a35c:: with SMTP id v28mr1883676pgn.144.1564208949527; Fri, 26 Jul 2019 23:29:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564208949; cv=none; d=google.com; s=arc-20160816; b=vvfZ9HzQ7hA6YVGkILCetC6zh4QVN2yRm5ARuelhHIwO7R5DB5z3YbyWpkxgOT370Z NWyZO4D8d/nf49sB6MHMD00B8Msq9bfUtgqAS0LdEuLm/Pt9PYlSw1D2Pk4zCP1SMn0l 6JOa/MVQKDVMhj3zbhMobuHmHemhxDW9WNX68P4HLSeQuPF0RwC9po1IX8W/F9WjlFR+ 9+bstCGLMlokegVsE8iGDY2NBYRAM46upCr42VanV/8jUr3fD0F0gdlTvDxrO9PsuiBo RGisf1tlV34Ou1YYBAB7L2gqz0JDoiEy0CEBkaawj5blu15bjJBDo+9I0mU8ZmjnYu9D 4FxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=ikueuywkwP0AWEgZnDinDEgc8dcvT18OIxOiRK5Ca7I=; b=MpQI7py9ZKxRH1YbOPgZS6+GDKal1pfo0TEH0vR4tZYszHBxu7+ayCQcKj1bI/ptdL kkIjLgovSNZodWmUD8M/5IU5eI9qf7o7uWCDwNAw/53Kx187+KBh+m8xs3U5Q0i7Fm7D zv8QTfEWE34YUAOt47fpOLHguXYDFIwiY1Z8n4xF5vpIB8MMb4yyWRKTb29TnvL5uH0j pOHkB7tFcS92LT/NW0zWQ9k+aUuwQ7wpeYhzpdkkkHoJ3ZL4+Y292i4ENm5Dy2Y8XT3A JES8VLUXSPtboJlFE1EOEvxhLdjgZsh5HPUW3dVglO0+ZhG8Ry/dOC3e2/cG1sq0HcaR NHxA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m12si22847228plt.413.2019.07.26.23.28.41; Fri, 26 Jul 2019 23:29:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727572AbfG0FrZ (ORCPT + 99 others); Sat, 27 Jul 2019 01:47:25 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:38002 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726010AbfG0FrY (ORCPT ); Sat, 27 Jul 2019 01:47:24 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B11BDA591B15D1329791; Sat, 27 Jul 2019 13:47:21 +0800 (CST) Received: from [127.0.0.1] (10.177.31.14) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Sat, 27 Jul 2019 13:47:20 +0800 Subject: Re: [RFC PATCH 0/3] md: export internal stats through debugfs To: Song Liu CC: linux-raid , Song Liu , NeilBrown , , , , , open list References: <20190702132918.114818-1-houtao1@huawei.com> From: Hou Tao Message-ID: Date: Sat, 27 Jul 2019 13:47:19 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.31.14] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 2019/7/23 5:31, Song Liu wrote: > On Tue, Jul 2, 2019 at 6:25 AM Hou Tao wrote: >> >> Hi, >> >> There are so many io counters, stats and flags in md, so I think >> export these info to userspace will be helpful for online-debugging, >> especially when the vmlinux file and the crash utility are not >> available. And these info can also be utilized during code >> understanding. >> >> MD has already exported some stats through sysfs files under >> /sys/block/mdX/md, but using sysfs file to export more internal >> stats are not a good choice, because we need to create a single >> sysfs file for each internal stat according to the use convention >> of sysfs and there are too many internal stats. Further, the >> newly-created sysfs files would become APIs for userspace tools, >> but that is not we wanted, because these files are related with >> internal stats and internal stats may change from time to time. >> >> And I think debugfs is a better choice. Because we can show multiple >> related stats in a debugfs file, and the debugfs file will never be >> used as an userspace API. >> >> Two debugfs files are created to expose these internal stats: >> * iostat: io counters and io related stats (e.g., mddev->active_io, >> r1conf->nr_pending, or r1confi->retry_list) >> * stat: normal stats/flags (e.g., mddev->recovery, conf->array_frozen) >> >> Because internal stats are spreaded all over md-core and md-personality, >> so both md-core and md-personality will create these two debugfs files >> under different debugfs directory. >> >> Patch 1 factors out the debugfs files creation routine for md-core and >> md-personality, patch 2 creates two debugfs files: iostat & stat under >> /sys/kernel/debug/block/mdX for md-core, and patch 3 creates two debugfs >> files: iostat & stat under /sys/kernel/debug/block/mdX/raid1 for md-raid1. >> >> The following lines show the hierarchy and the content of these debugfs >> files for a RAID1 device: >> >> $ pwd >> /sys/kernel/debug/block/md0 >> $ tree >> . >> ├── iostat >> ├── raid1 >> │ ├── iostat >> │ └── stat >> └── stat >> >> $ cat iostat >> active_io 0 >> sb_wait 0 pending_writes 0 >> recovery_active 0 >> bitmap pending_writes 0 >> >> $ cat stat >> flags 0x20 >> sb_flags 0x0 >> recovery 0x0 >> >> $ cat raid1/iostat >> retry_list active 0 >> bio_end_io_list active 0 >> pending_bio_list active 0 cnt 0 >> sync_pending 0 >> nr_pending 0 >> nr_waiting 0 >> nr_queued 0 >> barrier 0 > > Hi, > > Sorry for the late reply. > > I think these information are really debug information that we should not > show in /sys. Once we expose them in /sys, we need to support them > because some use space may start searching data from them. So debugfs is used to place these debug information instead of sysfs. It's OK for user-space tools to search data from these files as long as these tools don't expect these information to be stable. And the most possible user of these files would be test programs, and if some user-space tools may truly expect some stable information from the debugfs file, maybe we should move these information from debugfs to sysfs file. Regards, Tao > > Thanks, > Song > > . >