Skip to content

Commit 24bbb1f

Browse files
Michael HolzheuLinus Torvalds
authored andcommitted
[PATCH] s390_hypfs filesystem
On zSeries machines there exists an interface which allows the operating system to retrieve LPAR hypervisor accounting data. For example, it is possible to get usage data for physical and virtual cpus. In order to provide this information to user space programs, I implemented a new virtual Linux file system named 's390_hypfs' using the Linux 2.6 libfs framework. The name 's390_hypfs' stands for 'S390 Hypervisor Filesystem'. All the accounting information is put into different virtual files which can be accessed from user space. All data is represented as ASCII strings. When the file system is mounted the accounting information is retrieved and a file system tree is created with the attribute files containing the cpu information. The content of the files remains unchanged until a new update is made. An update can be triggered from user space through writing 'something' into a special purpose update file. We create the following directory structure: <mount-point>/ update cpus/ <cpu-id> type mgmtime <cpu-id> ... hyp/ type systems/ <lpar-name> cpus/ <cpu-id> type mgmtime cputime onlinetime <cpu-id> ... <lpar-name> cpus/ ... - update: File to trigger update - cpus/: Directory for all physical cpus - cpus/<cpu-id>/: Directory for one physical cpu. - cpus/<cpu-id>/type: Type name of physical zSeries cpu. - cpus/<cpu-id>/mgmtime: Physical-LPAR-management time in microseconds. - hyp/: Directory for hypervisor information - hyp/type: Typ of hypervisor (currently only 'LPAR Hypervisor') - systems/: Directory for all LPARs - systems/<lpar-name>/: Directory for one LPAR. - systems/<lpar-name>/cpus/<cpu-id>/: Directory for the virtual cpus - systems/<lpar-name>/cpus/<cpu-id>/type: Typ of cpu. - systems/<lpar-name>/cpus/<cpu-id>/mgmtime: Accumulated number of microseconds during which a physical CPU was assigned to the logical cpu and the cpu time was consumed by the hypervisor and was not provided to the LPAR (LPAR overhead). - systems/<lpar-name>/cpus/<cpu-id>/cputime: Accumulated number of microseconds during which a physical CPU was assigned to the logical cpu and the cpu time was consumed by the LPAR. - systems/<lpar-name>/cpus/<cpu-id>/onlinetime: Accumulated number of microseconds during which the logical CPU has been online. As mount point for the filesystem /sys/hypervisor/s390 is created. The update process is triggered when writing 'something' into the 'update' file at the top level hypfs directory. You can do this e.g. with 'echo 1 > update'. During the update the whole directory structure is deleted and built up again. Cc: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Ingo Oeser <ioe-lkml@rameria.de> Cc: Joern Engel <joern@wohnheim.fh-wedel.de> Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Michael Holzheu <holzheu@de.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1 parent b9e122c commit 24bbb1f

7 files changed

Lines changed: 1250 additions & 1 deletion

File tree

‎arch/s390/Kconfig‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,14 @@ config NO_IDLE_HZ_INIT
446446
The HZ timer is switched off in idle by default. That means the
447447
HZ timer is already disabled at boot time.
448448

449+
config S390_HYPFS_FS
450+
bool "s390 hypervisor file system support"
451+
select SYS_HYPERVISOR
452+
default y
453+
help
454+
This is a virtual file system intended to provide accounting
455+
information in an s390 hypervisor environment.
456+
449457
config KEXEC
450458
bool "kexec system call (EXPERIMENTAL)"
451459
depends on EXPERIMENTAL

‎arch/s390/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ LDFLAGS_vmlinux := -e start
7676
head-y := arch/$(ARCH)/kernel/head.o arch/$(ARCH)/kernel/init_task.o
7777

7878
core-y += arch/$(ARCH)/mm/ arch/$(ARCH)/kernel/ arch/$(ARCH)/crypto/ \
79-
arch/$(ARCH)/appldata/
79+
arch/$(ARCH)/appldata/ arch/$(ARCH)/hypfs/
8080
libs-y += arch/$(ARCH)/lib/
8181
drivers-y += drivers/s390/
8282
drivers-$(CONFIG_MATHEMU) += arch/$(ARCH)/math-emu/

‎arch/s390/hypfs/Makefile‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#
2+
# Makefile for the linux hypfs filesystem routines.
3+
#
4+
5+
obj-$(CONFIG_S390_HYPFS_FS) += s390_hypfs.o
6+
7+
s390_hypfs-objs := inode.o hypfs_diag.o

‎arch/s390/hypfs/hypfs.h‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* fs/hypfs/hypfs.h
3+
* Hypervisor filesystem for Linux on s390.
4+
*
5+
* Copyright (C) IBM Corp. 2006
6+
* Author(s): Michael Holzheu <holzheu@de.ibm.com>
7+
*/
8+
9+
#ifndef _HYPFS_H_
10+
#define _HYPFS_H_
11+
12+
#include <linux/fs.h>
13+
#include <linux/types.h>
14+
15+
#define REG_FILE_MODE 0440
16+
#define UPDATE_FILE_MODE 0220
17+
#define DIR_MODE 0550
18+
19+
extern struct dentry *hypfs_mkdir(struct super_block *sb, struct dentry *parent,
20+
const char *name);
21+
22+
extern struct dentry *hypfs_create_u64(struct super_block *sb,
23+
struct dentry *dir, const char *name,
24+
__u64 value);
25+
26+
extern struct dentry *hypfs_create_str(struct super_block *sb,
27+
struct dentry *dir, const char *name,
28+
char *string);
29+
30+
#endif /* _HYPFS_H_ */

0 commit comments

Comments
 (0)