Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp934892rdh; Fri, 24 Nov 2023 01:12:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IEATlC8W9Yn93tMih44wFDenjiIoIWnybQ3ZhCp5yqPq0rmRODTuUZnS9C2h7SAWPm5ttAX X-Received: by 2002:a17:902:ea10:b0:1ca:29f:4b06 with SMTP id s16-20020a170902ea1000b001ca029f4b06mr2714661plg.2.1700817177385; Fri, 24 Nov 2023 01:12:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700817177; cv=none; d=google.com; s=arc-20160816; b=Nj3wPUiAl75WDelrb/jlhrJyIpKLjH1wYCb1tQ2T5Z+SnS+CoTp9H7CX+wvU8BnoKI 0s2qs8EcF9Bi0FUo84yvIhmZSfcva7QFgByQTWoEyxafK6Q8Fvz2IPxxRkoljc9TdcWv rLaOk8gqezq9gcUX8N5NhRpnszliWE03GCBtRcbgKMtvHy6xq123zQ5uoVEA7dT1iSGF wf+MRwyXWnn3zDmVXF2fAj3XqRBPBI/9h6FZyE0j5MMYRpDzOOwLgAfqZPY3YP5I+ciY g8PALS1pTzKBW+SKfSuHxEM8VgMsKUrzOwNiUR+lMvR+CRW78VVCgxKDAzCuGrTScj6v poRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=4rrSJvqn2mqoWbaz6A5BzNAqqoovR/86fMxB6GyhmWs=; fh=y757WKqhp7YLoLu5MeP1hGH0XkyEMry3I2kvtdXeVZY=; b=dqcfg2RT1emXdwd9P4vK5hLy4Fi6AGrAdSqhSw17zC25gT5T08oqqiVxIXG8da7bUU iqUe6naN5f6/Tx/OXfGhMW3Ms1ifT/x6pLtxLo2LgDiF9hpvHcUyV0c7rsJdZpBB0RnB kXgNnroQ0z2CWDeMGmuDg1NH5diHDwu7Xvox3lARKK33aAUQ8rtJydch8uBvG2kcDAQp Q/4NW7iGhohM2KgeJ3729qxwBIBFgEySFLTpfQaiHaedqSsdTKft5FtfKz4EJvflfvGV GnrvkfliIawTphnhcMhIiN6+HKgnpoPgd9ELsFv+pDeEs2s/bvw5N+yxkEBhDrhXfaUS Xejg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id i15-20020a17090332cf00b001cf67876ecdsi184379plr.379.2023.11.24.01.12.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Nov 2023 01:12:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id DAFC98373531; Fri, 24 Nov 2023 01:12:54 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232958AbjKXJMd (ORCPT + 99 others); Fri, 24 Nov 2023 04:12:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233056AbjKXJMc (ORCPT ); Fri, 24 Nov 2023 04:12:32 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C477FD6C; Fri, 24 Nov 2023 01:12:35 -0800 (PST) Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Sc8Q42hZLz4f3m6s; Fri, 24 Nov 2023 17:12:28 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id AD7EF1A0498; Fri, 24 Nov 2023 17:12:32 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP1 (Coremail) with SMTP id cCh0CgDX2xH_aGBl5AQvBw--.26609S3; Fri, 24 Nov 2023 17:12:32 +0800 (CST) Subject: Re: [PATCH -next v2 1/6] md: remove useless debug code to print configuration To: Song Liu , Yu Kuai Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, yangerkun@huawei.com, "yukuai (C)" References: <20231021102059.3198284-1-yukuai1@huaweicloud.com> <20231021102059.3198284-2-yukuai1@huaweicloud.com> From: Yu Kuai Message-ID: <1f3080ca-cde6-2473-4679-a79fa744eb70@huaweicloud.com> Date: Fri, 24 Nov 2023 17:12:30 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: cCh0CgDX2xH_aGBl5AQvBw--.26609S3 X-Coremail-Antispam: 1UD129KBjvJXoW7CFWrXFyDAw43XrWxAFy3XFb_yoW8Xw4fp3 y3Ka4ayr4kCr4Fy3yDJw4fCFyfua98Jr45Kr9agryUZwn8CryI9r13Gryj9Fy5ur4vqrs0 9395XF4fWa48AFDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkK14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc7I2V7IY0VAS07AlzVAY IcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14 v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkG c2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI 0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E3s1lIxAIcVC2z280aVAFwI0_Jr0_ Gr1lIxAIcVC2z280aVCY1x0267AKxVW8JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUbXdbU UUUUU== X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-Spam-Status: No, score=-2.4 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 24 Nov 2023 01:12:55 -0800 (PST) Hi, 在 2023/11/24 16:17, Song Liu 写道: > On Fri, Oct 20, 2023 at 7:25 PM Yu Kuai wrote: >> >> From: Yu Kuai >> >> One the one hand, print_conf() can be called without grabbing >> 'reconfig_mtuex' and current rcu protection to access rdev through 'conf' >> is not safe. Fortunately, there is a separate rcu protection to access >> rdev from 'mddev->disks', and rdev is always removed from 'conf' before >> 'mddev->disks'. >> >> On the other hand, print_conf() is just used for debug, >> and user can always grab such information(/proc/mdstat and mdadm). >> >> There is no need to always enable this debug and try to fix misuse rcu >> protection for accessing rdev from 'conf', hence remove print_conf(). >> >> Signed-off-by: Yu Kuai > > I wouldn't call these debug functions useless. There is probably some > users who use them for debugging (or even in some automations). > How hard is it to keep these functions? Can we just add some lockdep > to these functions to make sure they are called from safe places? Okay, I can keep these debug code, and since these code are dereferencing rdev from conf, and they need new syncronization: 1) dereference rdev from mddev->disks instead of conf, and use rdev->raid_disk >= 0 to judge if this rdev is in conf. There might be a race window that rdev can be removed from conf, however, I think this dones't matter. Or: 2) grab 'active_io' before print_conf(), to make sure rdev won't be removed from conf. Thanks, Kuai > > Thanks, > Song > > [...] > . >