Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp221201rdh; Mon, 18 Dec 2023 17:40:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IFaUZ7k1wMGsSyThZ5JmLVY6//n3ND23leRbd0YDw++Djn18QJW9/a+eN/AHqww06ShFkD9 X-Received: by 2002:a05:6a20:d386:b0:190:1e0c:d29 with SMTP id iq6-20020a056a20d38600b001901e0c0d29mr29630383pzb.4.1702950016977; Mon, 18 Dec 2023 17:40:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702950016; cv=none; d=google.com; s=arc-20160816; b=wAN+fRLIiLZqJ8+a94yWI+ouNU42UVM7Cb5B23oMmYQQhwPhzUPEv5VEY/2CKIumZk Y08nxQQTZvs+sGT3I98FLLPmKGuRdYfhd9ZhOl0UQaHL7zDQ8tJ+4+92P1pUp0GVIxJQ Fu37msrDh28ZU2PWiM90gNFDfGyY3dzjtknR6Z1G91fXgSeJH75txLIqgsTPfQR6YFq3 kOdBj0PxUwtpz8XzFfP0IeekPmFHNMf42isixHKRDUucG2/GDpXMRNBH59FThGN5xO9y RUiod0PaYgnE1SkMJgglgDwgPgUJVwF47SO0YEFLD9HbIckwPetD/bkT0JYnfdz9X8qD lCWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :references:cc:to:subject; bh=juOWq9SnsIKs6eDuQI68sc52XxcVqUICnm1MsFrB7sM=; fh=Eh97/Co9/tQ3EtAC2LMO+e7RpPrgktu1Rs4x0cRnhuE=; b=MsSzEkg7DdRMWL6R221LigvKC7UeijtTKknhf2Mdjrf2su9J2DAFoH/e9yOn/pWErM Ft44w5Jr++SXWtYS/Jz3+TRjm8OxWsb8JFuPVVNiu3PiMx0im12pFv/wAukURo4WC17v DYHN/2BDAaGNkUySVfJxy7st/qDgk8HIXmmVqKs7LoHIicCrMofJE6t0/v66hQayNi4j Fqp/R6OlhyLTpleH0Gr172eRiHuB0lpQJStbDQ0pdAOtwFdEsOFzHss5iHrYdEu7347w WsaUWg1xeOMFWKHajYq/vlS9njGKRXkq90E8HCgGZh6vN3F1jvVBY75lJQBkHxysqEQe IHzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4561-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4561-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j21-20020a635955000000b005c603f06562si18787761pgm.333.2023.12.18.17.40.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 17:40:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4561-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-4561-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4561-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A398928604E for ; Tue, 19 Dec 2023 01:40:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 849ED1FB6; Tue, 19 Dec 2023 01:40:05 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B8F3615C3; Tue, 19 Dec 2023 01:40:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4SvKBD1kdpz4f3jLZ; Tue, 19 Dec 2023 09:39:48 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 652DD1A087A; Tue, 19 Dec 2023 09:39:53 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP1 (Coremail) with SMTP id cCh0CgDn6xFn9IBlFywiEA--.41035S3; Tue, 19 Dec 2023 09:39:53 +0800 (CST) Subject: Re: [PATCH v2 1/2] md: Fix overflow in is_mddev_idle To: Song Liu , Yu Kuai Cc: linan666@huaweicloud.com, axboe@kernel.dk, linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, yi.zhang@huawei.com, houtao1@huawei.com, yangerkun@huawei.com, "yukuai (C)" References: <20231215013931.3329455-1-linan666@huaweicloud.com> <20231215013931.3329455-2-linan666@huaweicloud.com> From: Yu Kuai Message-ID: <8713b617-db39-113a-377f-f97e123dbf9b@huaweicloud.com> Date: Tue, 19 Dec 2023 09:39:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgDn6xFn9IBlFywiEA--.41035S3 X-Coremail-Antispam: 1UD129KBjvJXoW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zhxuhorxvhhfrp/ Hi, 在 2023/12/19 0:04, Song Liu 写道: > On Sun, Dec 17, 2023 at 5:39 PM Yu Kuai wrote: >> > [...] >>> >>> We only use this for idle or not check, the behavior is OK (I think). >>> However, this logic is error prone. >>> >>> On 64-bit systems, there is a 4-byte hole behind sync_io. I think we can >>> just use it for atomic64_t so that we don't have to worry about overflow. >> >> I'm not sure about this, because other than this ubsan warning, this >> overflow doesn't have any impact on functionality to me. > > Fixing warnings for zero or low cost is always a good idea. It helps boost > the signal when UBSAN (and other debug features) detects real issues. > >> If we care about this 'hole', there are lots of holes in gendisk, and >> can be avoiled, for example, moving 'sync_io' near to 'node_id'. > > The point was not "let's fill the hole", but "we can use atomic64_t > without extra memory cost". In general, I don't think we care too > much about holes in "struct gendisk". > > Does this make sense? Of course, I don't have strong preference on this. Because our syzkaller reported lots of UBSAN warnings, hence only fix real issues is how we do it. For upstream, I'm good at fix this warning with zero or low cost. Thanks, Kuai > > Thanks, > Song > . >