Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp296272lqz; Fri, 29 Mar 2024 18:20:06 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX2eBT3HgGLXmBQyqrmPyTiOmlImhHWaL/jojmS5kWl/Cr2N+0H+wTIPJbMSfRPgjtWLhln3GYE8RO5odsvWqT1a+iVTsvgavCqvfB9jg== X-Google-Smtp-Source: AGHT+IEo3HgwDkwJh822D42MBrpuU+1HqENM1qhke/e6mcJOkEXegc5Zy23GiFX8B7jKC48FXiz/ X-Received: by 2002:a17:902:d2c2:b0:1e0:d0e8:b083 with SMTP id n2-20020a170902d2c200b001e0d0e8b083mr4375368plc.51.1711761605918; Fri, 29 Mar 2024 18:20:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711761605; cv=pass; d=google.com; s=arc-20160816; b=Fh5alBFvtch65pb20mVh8704gLWKcHJqRmEjEQzTz8VDXpwmSxCyrSnyjKm3YvgPAf BSBpmM6loWdTnUD4P79EvtHqlO/xlO6MxhdEHyEZVrFyKfROjo9UVe73tf8+W4Jjtq+2 tJKaL9d+1u4hfd/8zwxlcpLBHn8vAQBOaSFXrNhAk93vnKVX5388DXO5eID3PM89UsBg tSxghm05hi01myFgbtdWtlb218G5vGd4rwOewRULC2Xd58Ry5mICgSOoLDU/bjG0Wewc tDwkWpfDvlyMQdeLwGMKiteAOR2X43gbgxRb+Zl/IUqKP29o3ZUEFV2/3nSgxUcjf/Mc Swkw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id; bh=laVWUeYZY98HfU+y7hEN96AN7qH64SuumZCNqhQRBPI=; fh=Pvn+MyBBaNy5RXxfcloFUFKrmKtNn16iC4FmPmsztXE=; b=E3Rd5WJlkKi2Kr2NzD06hoKhG1Gocl8o/mRE/Yk5aQiAUTsqPip78HU2GzpFImNsMw 20VDDNnRozu8sttikPmgOiQeP0FAr5WSs6jd5OKl9+U4oNX9AMf7hCSFfNijHtXmAXjV CwWI0nxr/XRiP1RhHJ29Lt0z2diZGJhvFCY1RqSgSKbTFu7LwLJzvEDtgih8Ju2gYKv3 k/nWBfJxJaMHtG5Cgq7PoL84xJZlCgCV198PJuuc9K6PMw+mqj0B2RAA4kE17BMhH37A ZqZYfSpUoRHSDwKoeAPKPA+Rdb2hiH7QIH/aA5+I40tz6UfPYiKUo5zcmVPxbudyvkoV tazA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-125563-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125563-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id e17-20020a17090301d100b001defd1c0cafsi4753561plh.111.2024.03.29.18.20.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 18:20:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125563-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-125563-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125563-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EB0B0B224C0 for ; Sat, 30 Mar 2024 01:19:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B35361C3E; Sat, 30 Mar 2024 01:19:51 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 78F9315A5; Sat, 30 Mar 2024 01:19:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711761591; cv=none; b=LCC5ZHnKkaGMEUBh5cK26pjw46vqdNKtq5rQ6pgWwr+eiIhaF03ZmUT7aBBse+4KijKCXdLUI/jninUfAr7isbe6UBmP20vsxvhSnXFuWpQSyACu6ihmcB/FMAEb7sORyfmY2r5WDUdG4tEBcRjA+mFr2HsVqAkBtE5Psg+9Yh4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711761591; c=relaxed/simple; bh=SzSwPqnfalelzzooJos0UDdLGmQNrWe+krnbkhcDrLU=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=NGVqP4OqPVZRQde6eTIZyy+6NrRvPGUF64Yttvfyr2BZpfiqtl7w/Gq2tc2BWJ8+6eTb9w7r16/EhkEiQ31e35gj+bTAuaFB/cpcW64vGuEh4h+d8K48HxP8EorQCV9WHtTgmZDLAh/ap1gKptKil/lfv+o9yQzDmk88v3a+y7U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.188 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4V5ztt1rQtzbdZy; Sat, 30 Mar 2024 09:18:46 +0800 (CST) Received: from kwepemm600020.china.huawei.com (unknown [7.193.23.147]) by mail.maildlp.com (Postfix) with ESMTPS id 423D3140382; Sat, 30 Mar 2024 09:19:39 +0800 (CST) Received: from [10.174.179.160] (10.174.179.160) by kwepemm600020.china.huawei.com (7.193.23.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Sat, 30 Mar 2024 09:19:38 +0800 Message-ID: <8c424dfd-8ca0-6614-903f-a37dac818d27@huawei.com> Date: Sat, 30 Mar 2024 09:19:37 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH] swiotlb: Do not set total_used to 0 in swiotlb_create_debugfs_files() Content-Language: en-US To: Dexuan Cui , , , , , CC: , References: <20240329192809.17318-1-decui@microsoft.com> From: "zhangpeng (AS)" In-Reply-To: <20240329192809.17318-1-decui@microsoft.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To kwepemm600020.china.huawei.com (7.193.23.147) On 2024/3/30 3:28, Dexuan Cui wrote: > Sometimes the readout of /sys/kernel/debug/swiotlb/io_tlb_used and > io_tlb_used_hiwater can be a huge number (e.g. 18446744073709551615), > which is actually a negative number if we use "%ld" to print the number. > > When swiotlb_create_default_debugfs() is running from late_initcall, > mem->total_used may already be non-zero, because the storage driver > may have already started to perform I/O operations: if the storage > driver is built-in, its probe() callback is called before late_initcall. > > swiotlb_create_debugfs_files() should not blindly set mem->total_used > and mem->used_hiwater to 0; actually it doesn't have to initialize the > fields at all, because the fields, as part of the global struct > io_tlb_default_mem, have been implicitly initialized to zero. > > Also don't explicitly set mem->transient_nslabs to 0. > > Fixes: 8b0977ecc8b3 ("swiotlb: track and report io_tlb_used high water marks in debugfs") > Fixes: 02e765697038 ("swiotlb: add debugfs to track swiotlb transient pool usage") > Cc: stable@vger.kernel.org > Signed-off-by: Dexuan Cui Reviewed-by: ZhangPeng -- Best Regards, Peng