Received: by 2002:a05:7412:8d06:b0:f9:332d:97f1 with SMTP id bj6csp34699rdb; Mon, 18 Dec 2023 08:13:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IE3usJAKiLmwtkRWthBo1X5nJ6Naxk5xF3X2K1vQEKbtKN5xPIdV/iVnKCEmRqPfNHP1+oi X-Received: by 2002:a17:907:720d:b0:a19:a19b:55e1 with SMTP id dr13-20020a170907720d00b00a19a19b55e1mr8975935ejc.113.1702916001315; Mon, 18 Dec 2023 08:13:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702916001; cv=none; d=google.com; s=arc-20160816; b=xWzB6bgZgsqarh6S1Jsv8Rf3zLpG1wXP3qUorxgWysITY2x8pR8q9s19wJlfkivovu 9o94MF13PWD+P77ZlzwCFOU04mtbYaB92iC5Dtc70/ibv1fMgxWpu+xCjyAlAIAQib+D z9U4HLNjEARpGFBogo1ayvKHNwh8IV4CIVoebEeOY5PcwVYKanyVe/4+2RUzWSTPYXvN 6oC9xWF/cc6L8OJIpKGNJQszaMOtgAqqQjbR56gkR6UPo9viS56df8kcD5lFy/77XT4r Nu8nxd+/UAcdn5oXUzs6WqRRzAUPl9WhBnEr/zXnmVxZaHJ5cCDROlRqX6AenqyDJKri Y3jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=OgWJmywELp3Es4xvrKB6j9HQeEmN9xnLu/vHymr5vW0=; fh=wLI906liwyFAqCm+MOQB1j8eDydeZ97JTZyJ29sG0Mg=; b=oHHViETKuFGN+3/weFBb9JLvHr7KHpbIMIX9B28KT2pyo22OzL4+DvPL0fDFxrE5B8 +QlNI3rPvRKrRJNqli+15sTE0AkIA768euzdpZhKXIo46joAKkot3y6N/5GCU1LY4ILT pubLdA09sV25OjrcrITyyngj7FCOOSaKWjVhd+HodMcBRY1GQw7zdnAfqZFtRaDGVz6u q3/jFnqhGah5Lpc4CUGKc8f2SHBAzfhW1veWn5sdsWTGdWOy8uUKEpwok2OOWVEWYCRN 0EHwb1Jbv/vHMXLYcl7G+3GC6FP3aBkPvbSHYijALC8oQEALxTjmdJdKxbsQsUxh/zbS KWBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W2ULm2DH; spf=pass (google.com: domain of linux-kernel+bounces-4028-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4028-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ci19-20020a170906c35300b00a23526d2e53si1176252ejb.175.2023.12.18.08.13.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 08:13:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4028-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=W2ULm2DH; spf=pass (google.com: domain of linux-kernel+bounces-4028-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4028-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 503251F2425E for ; Mon, 18 Dec 2023 16:08:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A6A1498B9; Mon, 18 Dec 2023 16:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="W2ULm2DH" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 2FA193D54C; Mon, 18 Dec 2023 16:05:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F595C433C9; Mon, 18 Dec 2023 16:05:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702915503; bh=YKnvFnU90MLtOfW7ZUGVnLDGtzT+XNtezHnJjjlx3W4=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=W2ULm2DHLvbKgwufoXz2eG7C0DCc2cZA5ADG1JYOZJkarrfvBCa7mIRPhjQhyfuFf GK+MUvYbyKACtve62uXxQoEDx6eAEzWGn1fsPbfjKQKx7F0cPvmzZydXNgg6P40sVg 8j2jSJvnH912ldoUXzQMIiG+CNv1176HUTg8b0mTDlEuGGBnqOuo9MRUhkNMHAcYLF 2xYJDcmpt9borp/yNzZJ5imcFBWNERprz91h0Kc5ac9+JllMuSCAzM0sy8H87t8Y4n rzPa4UmgFyRcWXNqLiVt2T9/1TlJiBqiZF63bO6R5rpdp/UInbcS5eCjVjt3ebE2G3 28hySGJKpa+rA== Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2cc3f5e7451so39120811fa.2; Mon, 18 Dec 2023 08:05:03 -0800 (PST) X-Gm-Message-State: AOJu0YxnQZR3Bki2E3Xpj3IvMOXkkmO7iP2dYfHs0QlLSb7tjweVo7+G DcErfH9v8d3Sjth8b2yaW1aSqJijT4W1DDh0ZX8= X-Received: by 2002:a05:651c:506:b0:2cb:3ece:1235 with SMTP id o6-20020a05651c050600b002cb3ece1235mr6781953ljp.38.1702915501728; Mon, 18 Dec 2023 08:05:01 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231215013931.3329455-1-linan666@huaweicloud.com> <20231215013931.3329455-2-linan666@huaweicloud.com> In-Reply-To: From: Song Liu Date: Mon, 18 Dec 2023 08:04:50 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 1/2] md: Fix overflow in is_mddev_idle To: 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)" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Dec 17, 2023 at 5:39=E2=80=AFPM Yu Kuai w= rote: > [...] > > > > 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 ca= n > > just use it for atomic64_t so that we don't have to worry about overflo= w. > > 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? Thanks, Song