lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240415163212.GE2320920@kernel.org>
Date: Mon, 15 Apr 2024 17:32:12 +0100
From: Simon Horman <horms@...nel.org>
To: Yi-De Wu <yi-de.wu@...iatek.com>
Cc: Yingshiuan Pan <yingshiuan.pan@...iatek.com>,
	Ze-Yu Wang <ze-yu.wang@...iatek.com>, Rob Herring <robh@...nel.org>,
	Krzysztof Kozlowski <krzk+dt@...nel.org>,
	Conor Dooley <conor+dt@...nel.org>,
	Jonathan Corbet <corbet@....net>,
	Catalin Marinas <catalin.marinas@....com>,
	Will Deacon <will@...nel.org>,
	Richard Cochran <richardcochran@...il.com>,
	Matthias Brugger <matthias.bgg@...il.com>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-doc@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
	netdev@...r.kernel.org, linux-mediatek@...ts.infradead.org,
	David Bradil <dbrazdil@...gle.com>,
	Trilok Soni <quic_tsoni@...cinc.com>,
	My Chuang <my.chuang@...iatek.com>,
	Shawn Hsiao <shawn.hsiao@...iatek.com>,
	PeiLun Suei <peilun.suei@...iatek.com>,
	Liju Chen <liju-clr.chen@...iatek.com>,
	Willix Yeh <chi-shen.yeh@...iatek.com>,
	Kevenny Hsieh <kevenny.hsieh@...iatek.com>
Subject: Re: [PATCH v10 19/21] virt: geniezone: Provide individual VM memory
 statistics within debugfs

On Fri, Apr 12, 2024 at 02:57:16PM +0800, Yi-De Wu wrote:
> From: "Jerry Wang" <ze-yu.wang@...iatek.com>
> 
> Created a dedicated per-VM debugfs folder under gzvm, providing
> user-level programs with easy access to per-VM memory statistics for
> debugging and profiling purposes. This enables users to effectively
> analyze and optimize the memory usage of individual virtual machines.
> 
> Two types of information can be obtained:
> 
> `cat /sys/kernel/debug/gzvm/<pid>-<vmid>/protected_hyp_mem` shows memory
> used by the hypervisor and the size of the stage 2 table in bytes.
> 
> `cat /sys/kernel/debug/gzvm/<pid>-<vmid>/protected_shared_mem` gives
> memory used by the shared resources of the guest and host in bytes.
> 
> For example:
> console:/ # cat /sys/kernel/debug/gzvm/3417-15/protected_hyp_mem
> 180328
> console:/ # cat /sys/kernel/debug/gzvm/3417-15/protected_shared_mem
> 262144
> console:/ #
> 
> More stats will be added in the future.
> 
> Signed-off-by: Jerry Wang <ze-yu.wang@...iatek.com>
> Signed-off-by: Liju-Clr Chen <liju-clr.chen@...iatek.com>
> Signed-off-by: Yi-De Wu <yi-de.wu@...iatek.com>

...

> diff --git a/drivers/virt/geniezone/gzvm_vm.c b/drivers/virt/geniezone/gzvm_vm.c

...

> @@ -398,6 +409,113 @@ static void setup_vm_demand_paging(struct gzvm *vm)
>  	}
>  }
>  
> +static int debugfs_open(struct inode *inode, struct file *file)
> +{
> +	file->private_data = inode->i_private;
> +	return 0;
> +}

nit: Coccinelle suggests that simple_open() can be used in place
     of the debugfs_open() implementation above.

...

> +static const struct file_operations hyp_mem_fops = {
> +	.owner = THIS_MODULE,
> +	.open = debugfs_open,
> +	.read = hyp_mem_read,
> +	.llseek = no_llseek,
> +};
> +
> +static const struct file_operations shared_mem_fops = {
> +	.owner = THIS_MODULE,
> +	.open = debugfs_open,
> +	.read = shared_mem_read,
> +	.llseek = no_llseek,
> +};

...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ