[PATCH v5 4/4] selftests: KVM: extend get_cpuid_test to include KVM_GET_EMULATED_CPUID

2021-04-09 Thread Emanuele Giuseppe Esposito
the guest VM Signed-off-by: Emanuele Giuseppe Esposito --- .../selftests/kvm/x86_64/get_cpuid_test.c | 90 ++- 1 file changed, 88 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/get_cpuid_test.c b/tools/testing/selftests/kvm/x86_64/get_cpuid_test.c

[PATCH v5 1/4] KVM: x86: Fix a spurious -E2BIG in KVM_GET_EMULATED_CPUID

2021-04-09 Thread Emanuele Giuseppe Esposito
-by: Vitaly Kuznetsov Reviewed-by: Sean Christopherson Fixes: 433f4ba19041 ("KVM: x86: fix out-of-bounds write in KVM_GET_EMULATED_CPUID (CVE-2019-19332)") Signed-off-by: Emanuele Giuseppe Esposito --- arch/x86/kvm/cpuid.c | 33 - 1 file changed, 16

[PATCH v5 3/4] selftests: add kvm_get_emulated_cpuid to processor.h

2021-04-09 Thread Emanuele Giuseppe Esposito
As the similar kvm_get_supported_cpuid(), kvm_get_emulated_cpuid allocates and gets a struct kvm_cpuid2 filled with emulated features. Signed-off-by: Emanuele Giuseppe Esposito --- .../selftests/kvm/include/x86_64/processor.h | 1 + .../selftests/kvm/lib/x86_64/processor.c | 33

[PATCH v5 2/4] Documentation: KVM: update KVM_GET_EMULATED_CPUID ioctl description

2021-04-09 Thread Emanuele Giuseppe Esposito
. Signed-off-by: Emanuele Giuseppe Esposito --- Documentation/virt/kvm/api.rst | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 307f2fcf1b02..8ba23bc2a625 100644 --- a/Documentation/virt/kvm/api.rst

[PATCH v5 0/4] KVM: cpuid: fix KVM_GET_EMULATED_CPUID implementation

2021-04-09 Thread Emanuele Giuseppe Esposito
the ioctl documentation accordingly and patches 3 and 4 extend the x86_64/get_cpuid_test.c selftest to check the intended behavior of KVM_GET_EMULATED_CPUID. Signed-off-by: Emanuele Giuseppe Esposito --- v5: - Better comment in cpuid.c (patch 1) Emanuele Giuseppe Esposito (4): KVM: x86: Fix

Re: [PATCH v4 1/4] KVM: x86: Fix a spurious -E2BIG in KVM_GET_EMULATED_CPUID

2021-04-09 Thread Emanuele Giuseppe Esposito
On 08/04/2021 22:29, Sean Christopherson wrote: On Thu, Apr 08, 2021, Emanuele Giuseppe Esposito wrote: When retrieving emulated CPUID entries, check for an insufficient array size if and only if KVM is actually inserting an entry. If userspace has a priori knowledge of the exact array size

[PATCH v4 4/4] selftests: KVM: extend get_cpuid_test to include KVM_GET_EMULATED_CPUID

2021-04-08 Thread Emanuele Giuseppe Esposito
the guest VM Signed-off-by: Emanuele Giuseppe Esposito --- .../selftests/kvm/x86_64/get_cpuid_test.c | 90 ++- 1 file changed, 88 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/get_cpuid_test.c b/tools/testing/selftests/kvm/x86_64/get_cpuid_test.c

[PATCH v4 3/4] selftests: add kvm_get_emulated_cpuid to processor.h

2021-04-08 Thread Emanuele Giuseppe Esposito
As the similar kvm_get_supported_cpuid(), kvm_get_emulated_cpuid allocates and gets a struct kvm_cpuid2 filled with emulated features. Signed-off-by: Emanuele Giuseppe Esposito --- .../selftests/kvm/include/x86_64/processor.h | 1 + .../selftests/kvm/lib/x86_64/processor.c | 33

[PATCH v4 2/4] Documentation: KVM: update KVM_GET_EMULATED_CPUID ioctl description

2021-04-08 Thread Emanuele Giuseppe Esposito
. Signed-off-by: Emanuele Giuseppe Esposito --- Documentation/virt/kvm/api.rst | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 307f2fcf1b02..8ba23bc2a625 100644 --- a/Documentation/virt/kvm/api.rst

[PATCH v4 1/4] KVM: x86: Fix a spurious -E2BIG in KVM_GET_EMULATED_CPUID

2021-04-08 Thread Emanuele Giuseppe Esposito
: 433f4ba19041 ("KVM: x86: fix out-of-bounds write in KVM_GET_EMULATED_CPUID (CVE-2019-19332)") Signed-off-by: Emanuele Giuseppe Esposito --- arch/x86/kvm/cpuid.c | 33 - 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/arch/x86/kvm/cpuid.c b/ar

[PATCH v4 0/4] KVM: cpuid: fix KVM_GET_EMULATED_CPUID implementation

2021-04-08 Thread Emanuele Giuseppe Esposito
the ioctl documentation accordingly and patches 3 and 4 extend the x86_64/get_cpuid_test.c selftest to check the intended behavior of KVM_GET_EMULATED_CPUID. Signed-off-by: Emanuele Giuseppe Esposito --- v4: - Address nitpicks given in the mailing list Emanuele Giuseppe Esposito (4): KVM: x86: Fix

[PATCH v3 4/4] selftests: KVM: extend get_cpuid_test to include KVM_GET_EMULATED_CPUID

2021-04-06 Thread Emanuele Giuseppe Esposito
the guest VM Signed-off-by: Emanuele Giuseppe Esposito --- .../selftests/kvm/x86_64/get_cpuid_test.c | 90 ++- 1 file changed, 88 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm/x86_64/get_cpuid_test.c b/tools/testing/selftests/kvm/x86_64/get_cpuid_test.c

[PATCH v3 3/4] selftests: add kvm_get_emulated_cpuid to processor.h

2021-04-06 Thread Emanuele Giuseppe Esposito
As the similar kvm_get_supported_cpuid(), kvm_get_emulated_cpuid allocates and gets a struct kvm_cpuid2 filled with emulated features. Signed-off-by: Emanuele Giuseppe Esposito --- .../selftests/kvm/include/x86_64/processor.h | 1 + .../selftests/kvm/lib/x86_64/processor.c | 33

[PATCH v3 2/4] Documentation: KVM: update KVM_GET_EMULATED_CPUID ioctl description

2021-04-06 Thread Emanuele Giuseppe Esposito
. Signed-off-by: Emanuele Giuseppe Esposito --- Documentation/virt/kvm/api.rst | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 307f2fcf1b02..8ba23bc2a625 100644 --- a/Documentation/virt/kvm/api.rst

[PATCH v3 1/4] KVM: x86: Fix a spurious -E2BIG in KVM_GET_EMULATED_CPUID

2021-04-06 Thread Emanuele Giuseppe Esposito
-by: Emanuele Giuseppe Esposito --- arch/x86/kvm/cpuid.c | 33 - 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index 6bd2f8b830e4..27059ddf9f0a 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c

[PATCH v3 0/4] KVM: cpuid: fix KVM_GET_EMULATED_CPUID implementation

2021-04-06 Thread Emanuele Giuseppe Esposito
the ioctl documentation accordingly and patches 3 and 4 extend the x86_64/get_cpuid_test.c selftest to check the intended behavior of KVM_GET_EMULATED_CPUID. Signed-off-by: Emanuele Giuseppe Esposito --- v3: - clearer commit message and problem explanation - pre-initialize the stack variable 'entry

Re: [PATCH 4/4] selftests: kvm: add get_emulated_cpuid test

2021-04-01 Thread Emanuele Giuseppe Esposito
+static void check_cpuid(struct kvm_cpuid2 *cpuid, struct kvm_cpuid_entry2 *entrie) +{ + int i; + + for (i = 0; i < cpuid->nent; i++) { + if (cpuid->entries[i].function == entrie->function && + cpuid->entries[i].index == entrie->index) { +

Re: [PATCH v2 1/4] kvm: cpuid: adjust the returned nent field of kvm_cpuid2 for KVM_GET_SUPPORTED_CPUID and KVM_GET_EMULATED_CPUID

2021-04-01 Thread Emanuele Giuseppe Esposito
On 31/03/2021 20:31, Sean Christopherson wrote: On Wed, Mar 31, 2021, Emanuele Giuseppe Esposito wrote: Calling the kvm KVM_GET_[SUPPORTED/EMULATED]_CPUID ioctl requires a nent field inside the kvm_cpuid2 struct to be big enough to contain all entries that will be set by kvm. Therefore

[PATCH v2 3/4] selftests: add kvm_get_emulated_cpuid

2021-03-31 Thread Emanuele Giuseppe Esposito
As the similar kvm_get_supported_cpuid, allocates and gets the struct kvm_cpuid2 filled with emulated features. Signed-off-by: Emanuele Giuseppe Esposito --- .../selftests/kvm/include/x86_64/processor.h | 1 + .../selftests/kvm/lib/x86_64/processor.c | 33 +++ 2 files

[PATCH v2 2/4] Documentation: kvm: update KVM_GET_EMULATED_CPUID ioctl description

2021-03-31 Thread Emanuele Giuseppe Esposito
. Signed-off-by: Emanuele Giuseppe Esposito --- Documentation/virt/kvm/api.rst | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 307f2fcf1b02..8ba23bc2a625 100644 --- a/Documentation/virt/kvm/api.rst

[PATCH v2 4/4] selftests: kvm: add get_emulated_cpuid test

2021-03-31 Thread Emanuele Giuseppe Esposito
Introduce a new selftest for the KVM_GET_EMULATED_CPUID ioctl. Since the behavior and functionality is similar to get_cpuid_test, the test checks: 1) checks for corner case in the nent field of the struct kvm_cpuid2. 2) sets and gets it as cpuid from the guest VM Signed-off-by: Emanuele Giuseppe

[PATCH v2 1/4] kvm: cpuid: adjust the returned nent field of kvm_cpuid2 for KVM_GET_SUPPORTED_CPUID and KVM_GET_EMULATED_CPUID

2021-03-31 Thread Emanuele Giuseppe Esposito
, when filling the entries do_cpuid_func() requires an additional entry, so if the right nent is known in advance, giving the exact number of entries won't work because it has to be increased by one. Signed-off-by: Emanuele Giuseppe Esposito --- arch/x86/kvm/cpuid.c | 35

[PATCH 0/4] kvm: cpuid: fix cpuid nent field

2021-03-31 Thread Emanuele Giuseppe Esposito
documentation accordingly and patches 3 and 4 provide a selftest to check KVM_GET_EMULATED_CPUID accordingly. Signed-off-by: Emanuele Giuseppe Esposito --- v2: - better fix in cpuid.c, perform the nent check after the switch statement - fix bug in get_emulated_cpuid.c selftest, each entry needs

Re: [PATCH 1/4] kvm: cpuid: adjust the returned nent field of kvm_cpuid2 for KVM_GET_SUPPORTED_CPUID and KVM_GET_EMULATED_CPUID

2021-03-31 Thread Emanuele Giuseppe Esposito
On 31/03/2021 09:56, Vitaly Kuznetsov wrote: Emanuele Giuseppe Esposito writes: On 31/03/2021 05:01, Sean Christopherson wrote: On Tue, Mar 30, 2021, Emanuele Giuseppe Esposito wrote: Calling the kvm KVM_GET_[SUPPORTED/EMULATED]_CPUID ioctl requires a nent field inside the kvm_cpuid2

Re: [PATCH 1/4] kvm: cpuid: adjust the returned nent field of kvm_cpuid2 for KVM_GET_SUPPORTED_CPUID and KVM_GET_EMULATED_CPUID

2021-03-31 Thread Emanuele Giuseppe Esposito
On 31/03/2021 05:01, Sean Christopherson wrote: On Tue, Mar 30, 2021, Emanuele Giuseppe Esposito wrote: Calling the kvm KVM_GET_[SUPPORTED/EMULATED]_CPUID ioctl requires a nent field inside the kvm_cpuid2 struct to be big enough to contain all entries that will be set by kvm. Therefore

[PATCH] kvm: fix minor typos in x86/kvm.h and selftests/processor.c

2021-03-30 Thread Emanuele Giuseppe Esposito
Signed-off-by: Emanuele Giuseppe Esposito --- tools/arch/x86/include/uapi/asm/kvm.h | 2 +- tools/testing/selftests/kvm/lib/x86_64/processor.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/arch/x86/include/uapi/asm/kvm.h b/tools/arch/x86/include/uapi

[PATCH 3/4] selftests: add kvm_get_emulated_cpuid

2021-03-30 Thread Emanuele Giuseppe Esposito
As the similar kvm_get_supported_cpuid, allocates and gets the struct kvm_cpuid2 filled with emulated features. Signed-off-by: Emanuele Giuseppe Esposito --- .../selftests/kvm/include/x86_64/processor.h | 1 + .../selftests/kvm/lib/x86_64/processor.c | 33 +++ 2 files

[PATCH 4/4] selftests: kvm: add get_emulated_cpuid test

2021-03-30 Thread Emanuele Giuseppe Esposito
Introduce a new selftest for the KVM_GET_EMULATED_CPUID ioctl. Since the behavior and functionality is similar to get_cpuid_test, the test checks: 1) checks for corner case in the nent field of the struct kvm_cpuid2. 2) sets and gets it as cpuid from the guest VM Signed-off-by: Emanuele Giuseppe

[PATCH 2/4] Documentation: kvm: update KVM_GET_EMULATED_CPUID ioctl description

2021-03-30 Thread Emanuele Giuseppe Esposito
. Signed-off-by: Emanuele Giuseppe Esposito --- Documentation/virt/kvm/api.rst | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst index 307f2fcf1b02..8ba23bc2a625 100644 --- a/Documentation/virt/kvm/api.rst

[PATCH 1/4] kvm: cpuid: adjust the returned nent field of kvm_cpuid2 for KVM_GET_SUPPORTED_CPUID and KVM_GET_EMULATED_CPUID

2021-03-30 Thread Emanuele Giuseppe Esposito
, when filling the entries do_cpuid_func() requires an additional entry, so if the right nent is known in advance, giving the exact number of entries won't work because it has to be increased by one. Signed-off-by: Emanuele Giuseppe Esposito --- arch/x86/kvm/cpuid.c | 6 ++ 1 file changed, 6

[PATCH 0/4] kvm: cpuid: fix cpuid nent field

2021-03-30 Thread Emanuele Giuseppe Esposito
documentation accordingly and patches 3 and 4 provide a selftest to check KVM_GET_EMULATED_CPUID accordingly. Emanuele Giuseppe Esposito (4): kvm: cpuid: adjust the returned nent field of kvm_cpuid2 for KVM_GET_SUPPORTED_CPUID and KVM_GET_EMULATED_CPUID Documentation: kvm: update

[PATCH] documentation/kvm: additional explanations on KVM_SET_BOOT_CPU_ID

2021-03-19 Thread Emanuele Giuseppe Esposito
The ioctl KVM_SET_BOOT_CPU_ID fails when called after vcpu creation. Add this explanation in the documentation. Signed-off-by: Emanuele Giuseppe Esposito --- Documentation/virt/kvm/api.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/virt/kvm/api.rst b

Re: [PATCH v2 2/2] selftests/kvm: add set_boot_cpu_id test

2021-03-19 Thread Emanuele Giuseppe Esposito
On 18/03/2021 17:20, Andrew Jones wrote: On Thu, Mar 18, 2021 at 04:16:24PM +0100, Emanuele Giuseppe Esposito wrote: Test for the KVM_SET_BOOT_CPU_ID ioctl. Check that it correctly allows to change the BSP vcpu. v1 -> v2: - remove unnecessary printf - move stage for loop inside run_v

Re: [PATCH] selftests/kvm: add get_msr_index_features

2021-03-19 Thread Emanuele Giuseppe Esposito
Hi Andrew, Thank you for the feedback (also in v1). On 18/03/2021 18:03, Andrew Jones wrote: On Thu, Mar 18, 2021 at 03:56:29PM +0100, Emanuele Giuseppe Esposito wrote: Test the KVM_GET_MSR_FEATURE_INDEX_LIST and KVM_GET_MSR_INDEX_LIST ioctls. Signed-off-by: Emanuele Giuseppe Esposito

[PATCH v2 2/2] selftests/kvm: add set_boot_cpu_id test

2021-03-18 Thread Emanuele Giuseppe Esposito
off-by: Emanuele Giuseppe Esposito --- tools/testing/selftests/kvm/.gitignore| 1 + tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/x86_64/set_boot_cpu_id.c| 166 ++ 3 files changed, 168 insertions(+) create mode 100644 tools/testing/selftests/kvm/x86

[PATCH v2 1/2] kvm/kvm_util: add _vm_ioctl

2021-03-18 Thread Emanuele Giuseppe Esposito
As in kvm_ioctl and _kvm_ioctl, add the respective _vm_ioctl for vm_ioctl. _vm_ioctl invokes an ioctl using the vm fd, leaving the caller to test the result. Signed-off-by: Emanuele Giuseppe Esposito --- tools/testing/selftests/kvm/include/kvm_util.h | 1 + tools/testing/selftests/kvm/lib

[PATCH] selftests/kvm: add get_msr_index_features

2021-03-18 Thread Emanuele Giuseppe Esposito
Test the KVM_GET_MSR_FEATURE_INDEX_LIST and KVM_GET_MSR_INDEX_LIST ioctls. Signed-off-by: Emanuele Giuseppe Esposito --- tools/testing/selftests/kvm/.gitignore| 1 + tools/testing/selftests/kvm/Makefile | 1 + .../kvm/x86_64/get_msr_index_features.c | 124

Re: [PATCH] selftests/kvm: add test for KVM_GET_MSR_FEATURE_INDEX_LIST

2021-03-17 Thread Emanuele Giuseppe Esposito
On 17/03/2021 11:49, Paolo Bonzini wrote: On 17/03/21 08:45, Emanuele Giuseppe Esposito wrote: +    struct kvm_msr_list features_list;   buffer.header.nmsrs = 1;   buffer.entry.index = msr_index; +    features_list.nmsrs = 1; +   kvm_fd = open(KVM_DEV_PATH, O_RDONLY

[PATCH] selftests/kvm: add test for KVM_GET_MSR_FEATURE_INDEX_LIST

2021-03-17 Thread Emanuele Giuseppe Esposito
Extend the kvm_get_feature_msr function to cover also KVM_GET_MSR_FEATURE_INDEX_LIST. Signed-off-by: Emanuele Giuseppe Esposito --- tools/testing/selftests/kvm/lib/x86_64/processor.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/tools/testing/selftests/kvm/lib/x86_64/processor.c b

[PATCH] selftests/kvm: add set_boot_cpu_id test

2021-03-17 Thread Emanuele Giuseppe Esposito
Test for the KVM_SET_BOOT_CPU_ID ioctl. Check that it correctly allows to change the BSP vcpu. Signed-off-by: Emanuele Giuseppe Esposito --- tools/testing/selftests/kvm/.gitignore| 1 + tools/testing/selftests/kvm/Makefile | 1 + .../selftests/kvm/x86_64/set_boot_cpu_id.c

[PATCH] doc/virt/kvm: move KVM_X86_SET_MSR_FILTER in section 8

2021-03-16 Thread Emanuele Giuseppe Esposito
in KVM_GET_MSR_INDEX_LIST ioctl description (section 4.3). Signed-off-by: Emanuele Giuseppe Esposito --- Documentation/virt/kvm/api.rst | 250 - 1 file changed, 125 insertions(+), 125 deletions(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt

Re: [PATCH v3 2/7] documentation for stats_fs

2020-06-04 Thread Emanuele Giuseppe Esposito
Hi, + +The STATS_FS_HIDDEN attribute won't affect the aggregation, it will only +block the creation of the files. Why does HIDDEN block the creation of files? instead of their visibility? The file itself is used to allow the user to view the content of a value. In order to make it hidden,

Re: [PATCH v3 3/7] kunit: tests for stats_fs API

2020-05-27 Thread Emanuele Giuseppe Esposito
In order to run them, the kernel .config must set CONFIG_KUNIT=y and a new .kunitconfig file must be created with CONFIG_STATS_FS=y and CONFIG_STATS_FS_TEST=y It looks like CONFIG_STATS_FS is built-in, but it exports much of the functionality you are testing. However could the tests also

Re: [PATCH v3 0/7] Statsfs: a new ram-based file system for Linux kernel statistics

2020-05-27 Thread Emanuele Giuseppe Esposito
The file system is mounted on /sys/kernel/stats and would be already used by kvm. Statsfs was initially introduced by Paolo Bonzini [1]. What's the direct motivation for this work? Moving KVM stats out of debugfs? There's many reasons: one of these is not using debugfs for statistics,

Re: [PATCH v3 7/7] [not for merge] netstats: example use of stats_fs API

2020-05-26 Thread Emanuele Giuseppe Esposito
Hi Andrew How do you atomically get and display a group of statistics? If you look at how the netlink socket works, you will see code like: do { start = u64_stats_fetch_begin_irq(_stats->syncp); rx_packets =

[PATCH v3 7/7] [not for merge] netstats: example use of stats_fs API

2020-05-26 Thread Emanuele Giuseppe Esposito
Apply stats_fs on the networking statistics subsystem. Currently it only works with disabled network namespace (CONFIG_NET_NS=n), because multiple namespaces will have the same device name under the same root source that will cause a conflict in stats_fs. Signed-off-by: Emanuele Giuseppe

[PATCH v3 6/7] [not for merge] kvm: example of stats_fs_value show function

2020-05-26 Thread Emanuele Giuseppe Esposito
in the kvm//vcpu/mp_state file Signed-off-by: Emanuele Giuseppe Esposito --- arch/x86/kvm/stats_fs.c | 54 + 1 file changed, 54 insertions(+) diff --git a/arch/x86/kvm/stats_fs.c b/arch/x86/kvm/stats_fs.c index f6edebb9c559..902be18562da 100644 --- a/arch

[PATCH v3 4/7] stats_fs fs: virtual fs to show stats to the end-user

2020-05-26 Thread Emanuele Giuseppe Esposito
-by: Emanuele Giuseppe Esposito --- fs/stats_fs/Makefile | 2 +- fs/stats_fs/inode.c| 461 + fs/stats_fs/internal.h | 15 ++ fs/stats_fs/stats_fs.c | 92 +++- include/linux/stats_fs.h | 18 ++ include/uapi/linux/magic.h | 1 + tools

[PATCH v3 5/7] kvm_main: replace debugfs with stats_fs

2020-05-26 Thread Emanuele Giuseppe Esposito
/debugfs/kvm is left for backward compatibility. Signed-off-by: Emanuele Giuseppe Esposito --- arch/arm64/kvm/Kconfig | 1 + arch/arm64/kvm/guest.c | 2 +- arch/mips/kvm/Kconfig | 1 + arch/mips/kvm/mips.c| 2 +- arch/powerpc/kvm/Kconfig| 1

[PATCH v3 2/7] documentation for stats_fs

2020-05-26 Thread Emanuele Giuseppe Esposito
Html docs for a complete documentation of the stats_fs API, filesystem and usage. Signed-off-by: Emanuele Giuseppe Esposito --- Documentation/filesystems/index.rst| 1 + Documentation/filesystems/stats_fs.rst | 222 + 2 files changed, 223 insertions(+) create mode

[PATCH v3 3/7] kunit: tests for stats_fs API

2020-05-26 Thread Emanuele Giuseppe Esposito
the root directory of the linux kernel source tree: ./tools/testing/kunit/kunit.py run --timeout=30 --jobs=`nproc --all` Signed-off-by: Emanuele Giuseppe Esposito --- fs/Kconfig |6 + fs/stats_fs/Makefile |2 + fs/stats_fs/stats_fs-tests.c | 1097

[PATCH v3 1/7] stats_fs API: create, add and remove stats_fs sources and values

2020-05-26 Thread Emanuele Giuseppe Esposito
, the former calling it when it needs to display and clear statistics, the latter to add values and sources. Signed-off-by: Emanuele Giuseppe Esposito --- MAINTAINERS | 7 + fs/Kconfig | 14 + fs/Makefile | 1 + fs/stats_fs/Makefile | 5 + fs/stats_fs

[PATCH v3 0/7] Statsfs: a new ram-based file system for Linux kernel statistics

2020-05-26 Thread Emanuele Giuseppe Esposito
ttps://lore.kernel.org/kvm/5d6cdcb1-d8ad-7ae6-7351-3544e2fa3...@redhat.com/?fbclid=IwAR18LHJ0PBcXcDaLzILFhHsl3qpT3z2vlG60RnqgbpGYhDv7L43n0ZXJY8M Signed-off-by: Emanuele Giuseppe Esposito v2 -> v3 move kconfig entry in the pseudo filesystem menu, add documentation, get/clear function for valu

Re: [PATCH v2 0/5] Statsfs: a new ram-based file sytem for Linux kernel statistics

2020-05-11 Thread Emanuele Giuseppe Esposito
On 5/8/20 11:44 AM, Paolo Bonzini wrote: > So in general I'd say the sources/values model holds up. We certainly > want to: > > - switch immediately to callbacks instead of the type constants (so that > core statsfs code only does signed/unsigned) > > - add a field to distinguish cumulative

Re: [PATCH v2 0/5] Statsfs: a new ram-based file sytem for Linux kernel statistics

2020-05-05 Thread Emanuele Giuseppe Esposito
On 5/4/20 11:37 PM, David Rientjes wrote: On Mon, 4 May 2020, Emanuele Giuseppe Esposito wrote: In this patch series I introduce statsfs, a synthetic ram-based virtual filesystem that takes care of gathering and displaying statistics for the Linux kernel subsystems. This is exciting, we

[PATCH v2 1/5] refcount, kref: add dec-and-test wrappers for rw_semaphores

2020-05-04 Thread Emanuele Giuseppe Esposito
for stats_fs_source data structures, which are protected by an rw_semaphore to allow concurrent sysfs reads. Signed-off-by: Emanuele Giuseppe Esposito --- include/linux/kref.h | 11 +++ include/linux/refcount.h | 2 ++ lib/refcount.c | 32 3 files

[PATCH v2 5/5] kvm_main: replace debugfs with stats_fs

2020-05-04 Thread Emanuele Giuseppe Esposito
/debugfs/kvm is left for backward compatibility. Signed-off-by: Emanuele Giuseppe Esposito --- arch/arm64/kvm/Kconfig | 1 + arch/arm64/kvm/guest.c | 2 +- arch/mips/kvm/Kconfig | 1 + arch/mips/kvm/mips.c| 2 +- arch/powerpc/kvm/Kconfig| 1

[PATCH v2 2/5] stats_fs API: create, add and remove stats_fs sources and values

2020-05-04 Thread Emanuele Giuseppe Esposito
by a virtual file system in patch 4. Its usage will be shared between the stats_fs file system and the end-users like kvm, the former calling it when it needs to display and clear statistics, the latter to add values and sources. Signed-off-by: Emanuele Giuseppe Esposito --- MAINTAINERS

[PATCH v2 3/5] kunit: tests for stats_fs API

2020-05-04 Thread Emanuele Giuseppe Esposito
the root directory of the linux kernel source tree: ./tools/testing/kunit/kunit.py run --timeout=30 --jobs=`nproc --all` Signed-off-by: Emanuele Giuseppe Esposito --- fs/Kconfig |6 + fs/stats_fs/Makefile |2 + fs/stats_fs/stats_fs-tests.c | 1088

[PATCH v2 4/5] stats_fs fs: virtual fs to show stats to the end-user

2020-05-04 Thread Emanuele Giuseppe Esposito
, with the exception that the API is only composed by stats_fs_create_file, stats_fs_create_dir and stats_fs_remove. Signed-off-by: Emanuele Giuseppe Esposito --- fs/stats_fs/Makefile | 2 +- fs/stats_fs/inode.c| 337 + fs/stats_fs/internal.h

[PATCH v2 0/5] Statsfs: a new ram-based file sytem for Linux kernel statistics

2020-05-04 Thread Emanuele Giuseppe Esposito
FhHsl3qpT3z2vlG60RnqgbpGYhDv7L43n0ZXJY8M Signed-off-by: Emanuele Giuseppe Esposito v1->v2 remove unnecessary list_foreach_safe loops, fix wrong indentation, change statsfs in stats_fs Emanuele Giuseppe Esposito (5): refcount, kref: add dec-and-test wrappers for rw_semaphores stats_fs A