Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp186857lqz; Fri, 29 Mar 2024 12:52:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUE0YghDQcVqmtQ8efg6vNkbQHLwPMTcpxFzQpF2yc486565NTk+ezHDpR+wmB68WxhUOK6t//Z/RCRpOL7T4y0QgC2ycbr42aFZ9S+DA== X-Google-Smtp-Source: AGHT+IFds/iL6C+myLkU9aXoeE8It0eiQA9B8Gn552ZMcN5kAreZQnCrsQKufUrDuT6zRc5uVj63 X-Received: by 2002:a05:6512:453:b0:515:d088:77cb with SMTP id y19-20020a056512045300b00515d08877cbmr1962450lfk.6.1711741919901; Fri, 29 Mar 2024 12:51:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711741919; cv=pass; d=google.com; s=arc-20160816; b=ANpMuzkHcgAN+nhJo+hP1FWBRQ67oYJaFU+sxINXRjM0uGdLMcw8hU2ZyJ01mLGOEL dOwFcwfAffnwhEZ7pqVJmLxFGgg9JyUqkrsNJzCOpFtgCyK5NzdK0gHnJaIc1rzDnFPZ VVDdJUTYTQh4SUtaK0lJy4IKWml+4DNrXJUbmahXpKys8Iy4yZoUMcZHYKatUITgZZvM y5VYlgQga63PZA6G6A0JFmS3ETfbigrIQgNBJxRH3/CpHHStZ0wrmDMdSGCYZyTCUaHN sU+1QndSGkR3Q7/eVsWXRTmWbZE0MV5Z0vpQeJxpO6ldRUaJx+i2NqT1VC0AMDTfmcNc b74A== 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:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-filter; bh=cyTA2cENb6Yp33jOnm7DNF77XO+4wSIz79NQQoBF7v0=; fh=SQK3Ncm+yBTVy8iq9NPuLTCqQro3edXtloNb7nU8QwU=; b=QXwGPQ1epu74aNhyI5wjgf0IXxGmxtrJG0IW0aCqn1ZUvoe01rx9kVTqKIC8S++c+O bSx26F7hUEXy+LzXtqr/FXzpCRRCWRGKuE/fpx3wyyTSo8w/51yoMNI8jYk8AAJwaqa7 0wJiMcdzjyziZ6v5+NPZhueCMEQzjDQt5gBoAGP6AWQM86/QBrbxty4uNwUzDcusVOLH iwqdnaUWGF4jQ1Y/9PXF96NZM2lT7QGNd7DGroz1/mfvuPtwHN+dRbszGGTR9SLDbzNX 8SBagYT+TIstCdBhleIDkRER4+xsvYj27RD3UtUHN9+x0C6VtI/oKYYeQHCT+X8zSfbz OFZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=LsJqFqP0; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-125350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125350-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a10-20020a17090640ca00b00a472e032d75si2140420ejk.991.2024.03.29.12.51.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 12:51:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125350-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=@linux.microsoft.com header.s=default header.b=LsJqFqP0; arc=pass (i=1 spf=pass spfdomain=linux.microsoft.com dkim=pass dkdomain=linux.microsoft.com dmarc=pass fromdomain=linux.microsoft.com); spf=pass (google.com: domain of linux-kernel+bounces-125350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125350-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 89D081F24E26 for ; Fri, 29 Mar 2024 19:46:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EAAF013A403; Fri, 29 Mar 2024 19:46:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="LsJqFqP0" Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7B5F139D04; Fri, 29 Mar 2024 19:46:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711741594; cv=none; b=Yz6gHTW4S7ayAmn8404riFyNenqYo01C0qFhr1ESNGehOesNsq+Hw8eg83qroGzv4OD3UHIk5DDmZO5hszJq+sgZRm/5Ljkrx4sg6olgfK5CUz9LOyVzEFSAtlkjJJTFuEvD3XCIu5eO7yAdeJBuQSFOX4suwYHHfZ9WXCYcdTc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711741594; c=relaxed/simple; bh=zYYB0UTSbRLws4DW2xNoeDK8WItj9tGsyvCKAM5E+ls=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=sIuSx6SKkUZPvEaVGrtvx7vKNpjyFZPKB7B1fvl/krjvkMSFN9PB0O6nx1ZXqFsUUxrKYV9cibrzCaE29ol8zxZXHM1KNqInb5X+XopTw1C9QR27SCDE+WjlO64a1wrDHlih+Mtx+cX6jlNgqexYKEwDV4+M5v6uxZeVi4s4uqg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=LsJqFqP0; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Received: from [100.64.65.59] (unknown [20.29.225.195]) by linux.microsoft.com (Postfix) with ESMTPSA id 020AB20E6F42; Fri, 29 Mar 2024 12:46:31 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 020AB20E6F42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1711741592; bh=cyTA2cENb6Yp33jOnm7DNF77XO+4wSIz79NQQoBF7v0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=LsJqFqP02CUKkfUhLZjuUQr1pQ0xb9+ApnC1krA/TWB9Lz5UFhdI7zPFqztKo2pqG 7/gwAEzIUcbObSW9ZBpgKl6t7sB0LDeSXzbIjWEQsk/aYlz4DcpboWya7uegZW7AdH mIoWV9PzU/6HQlPtqK6yGo32BtA93gQ9TLv/HSCk= Message-ID: <07ed50c1-75a9-494c-8a6a-5edcc2d6f932@linux.microsoft.com> Date: Fri, 29 Mar 2024 12:46:30 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] swiotlb: Do not set total_used to 0 in swiotlb_create_debugfs_files() To: Dexuan Cui , hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com, zhangpeng362@huawei.com, iommu@lists.linux.dev, mhklinux@outlook.com Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20240329192809.17318-1-decui@microsoft.com> Content-Language: en-CA From: Easwar Hariharan In-Reply-To: <20240329192809.17318-1-decui@microsoft.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 3/29/2024 12:28 PM, 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 > --- > kernel/dma/swiotlb.c | 4 ---- > 1 file changed, 4 deletions(-) > Sorry, I'm missing a why in this commit message. Can you say what happens if the total_used and used_hiwater IS blindly set to 0? Is the only effect the change in the readout of the swiotlb debugfs files? Thanks, Easwar