[Qemu-devel] [PATCH 14/34] scripts/kvm/kvm_stat: Set sensible no. files rlimit

2015-12-10 Thread Janosch Frank
As num cpus * 1000 is NOT a sensible rlimit, we need to calculate a more accurate rlimit. The number of open files is directly dependent on the cpu count and on the number of trace points per cpu. A additional constant works as a buffer for files that are needed by python or do get opened when

[Qemu-devel] [PATCH 16/34] scripts/kvm/kvm_stat: Make cpu detection a function

2015-12-10 Thread Janosch Frank
The online cpus detection method is in the Stats class but does not use any class variables. Moving it out of the class to the platform detection function makes the Stats class more readable. --- scripts/kvm/kvm_stat | 30 +++--- 1 file changed, 15 insertions(+), 15

[Qemu-devel] [PATCH 28/34] scripts/kvm/kvm_stat: Fix output formatting

2015-12-10 Thread Janosch Frank
The key names in log mode were capped to 10 characters which is not enough for distinguishing between keys. Capping was therefore removed. In batch mode the spacing between keys and values was too narrow and therefore had to be extended to 42. --- scripts/kvm/kvm_stat | 4 ++-- 1 file changed, 2

[Qemu-devel] [PATCH 04/34] scripts/kvm/kvm_stat: Removed unneeded PERF constants

2015-12-10 Thread Janosch Frank
Only two of the constants are actually needed to set up the events, so the others were removed. All variables that used them were also removed. --- scripts/kvm/kvm_stat | 28 ++-- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/scripts/kvm/kvm_stat

[Qemu-devel] [PATCH 21/34] scripts/kvm/kvm_stat: Encapsulate filters variable

2015-12-10 Thread Janosch Frank
The variable was only used in one class but still was defined globally. Additionaly the detect_platform routine which prepares the data that goes into the variable was called on each start of the script, no matter if the class was needed. To make the variable local to the TracepointProvider

[Qemu-devel] [PATCH 23/34] scripts/kvm/kvm_stat: Cleanup of Groups class

2015-12-10 Thread Janosch Frank
Introduced separating newlines for readability and removed special treatment/variable of the group leader. Renamed fmt to read_format. The group leader's file descriptor will not be turned into a file object anymore, instead os.read is used to read from the descriptor. --- scripts/kvm/kvm_stat |

[Qemu-devel] [PATCH 09/34] scripts/kvm/kvm_stat: Introduce main function

2015-12-10 Thread Janosch Frank
The main function should be the main location for initialization and helps encapsulating variables into a scope. This way they don't have to be global and might be mistaken for local ones. As the providers variable is scoped now it can't be accessed from within the Stats class. Hence, the global

[Qemu-devel] [PATCH 30/34] scripts/kvm/kvm_stat: Cleanup and pre-init perf_event_attr

2015-12-10 Thread Janosch Frank
All initializations of the ctypes struct that don't need additional information were moved to its init method. The unneeded initializations for sample_type and sample_period were removed as they do not affect the counters that are read. This improves readability of the setup_event_attribute by

[Qemu-devel] [PATCH 31/34] scripts/kvm/kvm_stat: Read event values as u64

2015-12-10 Thread Janosch Frank
The struct read_format, which denotes the returned values on a read states that the values are u64 and not long long which is used for struct unpacking. Therefore the 'q' long long formatter was exchanged with 'Q' which is the format for u64 data. --- scripts/kvm/kvm_stat | 2 +- 1 file changed,

[Qemu-devel] [PATCH 13/34] scripts/kvm/kvm_stat: Fixup syscall error reporting

2015-12-10 Thread Janosch Frank
In 2008 a patch was written that introduced ctypes.get_errno() and set_errno() as official interfaces to the libc errno variable. Using them we can avoid accessing private libc variables. The patch was included in python 2.6. Also we need to raise the right exception, with the right parameters

[Qemu-devel] [PATCH 26/34] scripts/kvm/kvm_stat: Remove unneeded X86_EXIT_REASONS

2015-12-10 Thread Janosch Frank
The architecture detection method directly accesses vmx and smv exit reason constants. Therefore we don't need it anymore. --- scripts/kvm/kvm_stat | 5 - 1 file changed, 5 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index d81e7b6..345ead8 100755 ---

[Qemu-devel] [PATCH 00/34] kvm_stat: Cleanup and fixup

2015-12-10 Thread Janosch Frank
for all of its interface modes. Testing was done rarely on X86_64 RHEL 6.7 and mostly on s390. Tests on other architectures would be beneficial. Janosch Frank (34): scripts/kvm/kvm_stat: Cleanup of multiple imports scripts/kvm/kvm_stat: Replaced os.listdir with os.walk scripts/kvm/kvm_stat: Make

[Qemu-devel] [PATCH 25/34] scripts/kvm/kvm_stat: Group arch specific data

2015-12-10 Thread Janosch Frank
Using global variables and multiple initialization functions for arch specific data makes the code hard to read. By grouping them in the Arch class we encapsulate and initialize them in one place. --- scripts/kvm/kvm_stat | 106 +-- 1 file changed,

[Qemu-devel] [PATCH 32/34] scripts/kvm/kvm_stat: Fix rlimit for unprivileged users

2015-12-10 Thread Janosch Frank
Setting the hard limit as a unprivileged user either returns an error when it is higher than the current one or irreversibly sets it lower. Therefore we leave the hardlimit untouched as long as we don't need to raise it as this needs CAP_SYS_RESOURCE. This gives admins the possibility to run the

[Qemu-devel] [PATCH 01/34] scripts/kvm/kvm_stat: Cleanup of multiple imports

2015-12-10 Thread Janosch Frank
Removed multiple imports of the same module and moved all imports to the top. It is not necessary to import a module each time one of its functions/classes is used. For readability each import should get its own line. --- scripts/kvm/kvm_stat | 26 +++--- 1 file changed, 11

[Qemu-devel] [PATCH 19/34] scripts/kvm/kvm_stat: Cleanup of TracepointProvider

2015-12-10 Thread Janosch Frank
Variables with bad names like f and m were renamed to their full name, so it is clearer which data they contain. Unneeded variables were removed and the field generating code was moved in an own function. dict.iteritems() was removed as directly iterating over a dictionary also yields the needed

[Qemu-devel] [PATCH 27/34] scripts/kvm/kvm_stat: Make tui function a class

2015-12-10 Thread Janosch Frank
The tui function itself had a few sub-functions and therefore basically already was class-like. Making it an actual one with proper methods improved readability. The tui function lives on as a wrapper for the class. Also renamed single character variable name, so the name reflects the content.

[Qemu-devel] [PATCH 17/34] scripts/kvm/kvm_stat: Rename _perf_event_open

2015-12-10 Thread Janosch Frank
The underscore in front of the function name does not comply with the python coding guidelines. Reviewed-by: Jason J. Herne --- scripts/kvm/kvm_stat | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat

[Qemu-devel] [PATCH 15/34] scripts/kvm/kvm_stat: Cleanup of platform detection

2015-12-10 Thread Janosch Frank
s390 machines can also be detected via uname -m, i.e. python's os.uname, no need for more complicated checks. Calling uname once and saving its value for multiple checks is perfectly sufficient. We don't expect the machine's architecture to change when the script is running anyway. On multi-cpu

[Qemu-devel] [PATCH 33/34] scripts/kvm/kvm_stat: Fixup filtering

2015-12-10 Thread Janosch Frank
When filtering, the group leader event should not be disabled, as all other events under it will also be disabled. Also we should make sure that values from disabled fields will not be displayed. This also filters the fields from the log and batch output for better readability. Also the

[Qemu-devel] [PATCH 34/34] scripts/kvm/kvm_stat: Add interactive filtering

2015-12-10 Thread Janosch Frank
Interactively changing the filter is much more useful than the drilldown, because it is more versatile. With this patch, the filter can be changed by pressing 'f' in the text ui and entering a new filter regex. --- scripts/kvm/kvm_stat | 26 ++ 1 file changed, 26

[Qemu-devel] [PATCH 12/34] scripts/kvm/kvm_stat: Moved DebugfsProvider

2015-12-10 Thread Janosch Frank
When it is next to the TracepointProvider less scrolling is needed to change related, surrounding code. Reviewed-by: Jason J. Herne --- scripts/kvm/kvm_stat | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git

[Qemu-devel] [PATCH 10/34] scripts/kvm/kvm_stat: Fix spaces around keyword assignments

2015-12-10 Thread Janosch Frank
Keyword assignments should not not have spaces around the equal character according to PEP8. Reviewed-by: Jason J. Herne --- scripts/kvm/kvm_stat | 62 ++-- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git

[Qemu-devel] [PATCH 03/34] scripts/kvm/kvm_stat: Make constants uppercase

2015-12-10 Thread Janosch Frank
Constants should be uppercase with separating underscores, as requested in PEP8. This helps identifying them when reading the code. Reviewed-by: Jason J. Herne --- scripts/kvm/kvm_stat | 64 ++-- 1 file changed, 32

[Qemu-devel] [PATCH 02/34] scripts/kvm/kvm_stat: Replaced os.listdir with os.walk

2015-12-10 Thread Janosch Frank
Os.walk gives back lists of directories and files, no need to filter directories from the list that listdir gives back. To make it better understandable a wrapper with docstring was introduced. --- scripts/kvm/kvm_stat | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff

[Qemu-devel] [PATCH 22/34] scripts/kvm/kvm_stat: Cleanup of Stats class

2015-12-10 Thread Janosch Frank
Converted class definition to new style and renamed improper named variables. Introduced property for fields_filter. Moved member variable declaration to init, so one can see all class variables when reading the init method. Completely clear the values dict, as we don't need to keep single

[Qemu-devel] [PATCH 08/34] scripts/kvm/kvm_stat: Improve debugfs access checking

2015-12-10 Thread Janosch Frank
Access checking with F_OK was replaced with the better readable os.path.exists(). On Linux exists() returns False when the user doesn't have sufficient permissions for statting the directory. Therefore the error message now states that sufficient rights are needed when the check fails. Also

[Qemu-devel] [PATCH 29/34] scripts/kvm/kvm_stat: Move to argparse and add description

2015-12-10 Thread Janosch Frank
The OptionParser is deprecated since the introduction of the ArgumentParser in 2.7. Additionally added a description text for the script, so new users don't have to guess its purpose and inner workings. --- scripts/kvm/kvm_stat | 86 1 file

[Qemu-devel] [PATCH 18/34] scripts/kvm/kvm_stat: Introduce properties for providers

2015-12-10 Thread Janosch Frank
As previous commit authors used a mixture of setters/getters and direct access to class variables consolidating them the python way improved readability. Properties allow us to assign a value to a class variable through a setter without the need to call the setter ourselves. Reviewed-by: Jason

[Qemu-devel] [PATCH 11/34] scripts/kvm/kvm_stat: Rename variables that redefine globals

2015-12-10 Thread Janosch Frank
Filter, id and byte are builtin python modules which should not be redefined by local variables. Reviewed-by: Jason J. Herne --- scripts/kvm/kvm_stat | 23 --- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/scripts/kvm/kvm_stat

[Qemu-devel] [PATCH 24/34] scripts/kvm/kvm_stat: Cleanup of Event class

2015-12-10 Thread Janosch Frank
Added additional newlines for readability. Factored out attribute and event setup code into own methods. All data necessary for setting up the events was consolidated into one dictionary. That way we get rid of the large argument list of the functions that handle the data. Exchanged file() with

[Qemu-devel] [PATCH 05/34] scripts/kvm/kvm_stat: Mark globals in functions

2015-12-10 Thread Janosch Frank
Updating globals over the globals().update() method is not the standard way of changing globals. Marking variables as global and modifying them the standard way is better readable. --- scripts/kvm/kvm_stat | 41 ++--- 1 file changed, 22 insertions(+), 19

[Qemu-devel] [PATCH 06/34] scripts/kvm/kvm_stat: Invert dictionaries

2015-12-10 Thread Janosch Frank
The exit reasons dictionaries were defined number -> value but later on were accessed the other way around. Therefore a invert function inverted them. Defining them the right way removes the need to invert them and therefore also speeds up the script's setup process. --- scripts/kvm/kvm_stat |

[Qemu-devel] [PATCH 20/34] scripts/kvm/kvm_stat: Cleanup cpu list retrieval

2015-12-10 Thread Janosch Frank
Reading /sys/devices/system/cpu/online makes opening the cpu directories unnecessary and works on more/older systems. --- scripts/kvm/kvm_stat | 21 - 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index

[Qemu-devel] [PATCH 07/34] scripts/kvm/kvm_stat: Cleanup of path variables

2015-12-10 Thread Janosch Frank
Paths to debugfs and trace dirs are now specified globally to remove redundancies in the code. Reviewed-by: Jason J. Herne --- scripts/kvm/kvm_stat | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/kvm/kvm_stat

Re: [Qemu-devel] [PATCH 07/34] scripts/kvm/kvm_stat: Cleanup of path variables

2016-01-07 Thread Janosch Frank
On 01/07/2016 03:56 PM, Paolo Bonzini wrote: > > > On 10/12/2015 13:12, Janosch Frank wrote: >> if not os.access('/sys/kernel/debug', os.F_OK): > > PATH_DEBUGFS should be /sys/kernel/debug, while... > >> print 'Please enable CONFIG_DEBUG_FS in y

[Qemu-devel] [PATCH v2 19/34] scripts/kvm/kvm_stat: Cleanup of TracepointProvider

2016-01-11 Thread Janosch Frank
keys. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 40 +--- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index c4e22d0..032e491 100755 --- a/scrip

[Qemu-devel] [PATCH v2 08/34] scripts/kvm/kvm_stat: Improve debugfs access checking

2016-01-11 Thread Janosch Frank
added check for /sys/kernel/debug/tracing/. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 16 +++- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index 5ca09f4..6f0692d 100755 --- a/s

[Qemu-devel] [PATCH v2 11/34] scripts/kvm/kvm_stat: Rename variables that redefine globals

2016-01-11 Thread Janosch Frank
Filter, id and byte are builtin python modules which should not be redefined by local variables. Reviewed-by: Jason J. Herne <jjhe...@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 23 --- 1 file changed, 1

[Qemu-devel] [PATCH v2 16/34] scripts/kvm/kvm_stat: Make cpu detection a function

2016-01-11 Thread Janosch Frank
The online cpus detection method is in the Stats class but does not use any class variables. Moving it out of the class to the platform detection function makes the Stats class more readable. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_sta

[Qemu-devel] [PATCH v2 34/34] scripts/kvm/kvm_stat: Add optparse description

2016-01-11 Thread Janosch Frank
Added a description text that explains what the script does and which requirements have to be met to let it run. The help formatter class is needed as the default optparse formatter makes the text unreadable. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kv

[Qemu-devel] [PATCH v2 20/34] scripts/kvm/kvm_stat: Cleanup cpu list retrieval

2016-01-11 Thread Janosch Frank
Reading /sys/devices/system/cpu/online makes opening the cpu directories unnecessary and works on more/older systems. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 31 --- 1 file changed, 20 insertions(+), 11 deletions(-)

[Qemu-devel] [PATCH v2 30/34] scripts/kvm/kvm_stat: Read event values as u64

2016-01-11 Thread Janosch Frank
The struct read_format, which denotes the returned values on a read states that the values are u64 and not long long which is used for struct unpacking. Therefore the 'q' long long formatter was exchanged with 'Q' which is the format for u64 data. Signed-off-by: Janosch Frank <f

[Qemu-devel] [PATCH v2 12/34] scripts/kvm/kvm_stat: Moved DebugfsProvider

2016-01-11 Thread Janosch Frank
When it is next to the TracepointProvider less scrolling is needed to change related, surrounding code. Reviewed-by: Jason J. Herne <jjhe...@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 24 1 file

[Qemu-devel] [PATCH v2 28/34] scripts/kvm/kvm_stat: Fix output formatting

2016-01-11 Thread Janosch Frank
The key names in log mode were capped to 10 characters which is not enough for distinguishing between keys. Capping was therefore removed. In batch mode the spacing between keys and values was too narrow and therefore had to be extended to 42. Signed-off-by: Janosch Frank <f

[Qemu-devel] [PATCH v2 29/34] scripts/kvm/kvm_stat: Cleanup and pre-init perf_event_attr

2016-01-11 Thread Janosch Frank
by halfing its LOC. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index 3c32046..ea5bae8 100755 --- a/scripts/kvm/kvm_stat +++ b/scrip

[Qemu-devel] [PATCH v2 05/34] scripts/kvm/kvm_stat: Mark globals in functions

2016-01-11 Thread Janosch Frank
Updating globals over the globals().update() method is not the standard way of changing globals. Marking variables as global and modifying them the standard way is better readable. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_sta

[Qemu-devel] [PATCH v2 09/34] scripts/kvm/kvm_stat: Introduce main function

2016-01-11 Thread Janosch Frank
access to the variable was changed to a local one. Reviewed-by: Jason J. Herne <jjhe...@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 145 +++ 1 file changed, 78 insertions(+),

[Qemu-devel] [PATCH v2 02/34] scripts/kvm/kvm_stat: Replaced os.listdir with os.walk

2016-01-11 Thread Janosch Frank
Os.walk gives back lists of directories and files, no need to filter directories from the list that listdir gives back. To make it better understandable a wrapper with docstring was introduced. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_sta

[Qemu-devel] [PATCH v2 32/34] scripts/kvm/kvm_stat: Fixup filtering

2016-01-11 Thread Janosch Frank
the drilldown update now directly checks for the stats' field filter and (un)sets drilldown accordingly. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 32 +--- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/scrip

[Qemu-devel] [PATCH v2 31/34] scripts/kvm/kvm_stat: Fix rlimit for unprivileged users

2016-01-11 Thread Janosch Frank
the script as an unprivileged user to increase security. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index e71fbef..bab831d

[Qemu-devel] [PATCH v2 17/34] scripts/kvm/kvm_stat: Rename _perf_event_open

2016-01-11 Thread Janosch Frank
The underscore in front of the function name does not comply with the python coding guidelines. Reviewed-by: Jason J. Herne <jjhe...@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 4 ++-- 1 file changed, 2 insertions(+),

[Qemu-devel] [PATCH v2 13/34] scripts/kvm/kvm_stat: Fixup syscall error reporting

2016-01-11 Thread Janosch Frank
and a helpful message. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index b5422f8..457624d 100755 --- a/scripts/kvm/kvm_stat +++ b/s

[Qemu-devel] [PATCH v2 04/34] scripts/kvm/kvm_stat: Removed unneeded PERF constants

2016-01-11 Thread Janosch Frank
Only two of the constants are actually needed to set up the events, so the others were removed. All variables that used them were also removed. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 28 ++-- 1 file changed, 2 inse

[Qemu-devel] [PATCH v2 03/34] scripts/kvm/kvm_stat: Make constants uppercase

2016-01-11 Thread Janosch Frank
Constants should be uppercase with separating underscores, as requested in PEP8. This helps identifying them when reading the code. Reviewed-by: Jason J. Herne <jjhe...@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/k

[Qemu-devel] [PATCH v2 15/34] scripts/kvm/kvm_stat: Cleanup of platform detection

2016-01-11 Thread Janosch Frank
systems x86_init currently will get called multiple times, returning makes sure we don't waste cicles on that. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 31 ++- 1 file changed, 14 insertions(+), 17 deletions(-) diff

[Qemu-devel] [PATCH v2 22/34] scripts/kvm/kvm_stat: Cleanup of Stats class

2016-01-11 Thread Janosch Frank
values. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 52 +++- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index 7837f40..203873e 100755 --- a/s

[Qemu-devel] [PATCH v2 27/34] scripts/kvm/kvm_stat: Make tui function a class

2016-01-11 Thread Janosch Frank
for proposing it and supplying me with most of the code. Also renamed single character variable name, so the name reflects the content. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 121 --- 1 file changed, 77 inse

[Qemu-devel] [PATCH v2 18/34] scripts/kvm/kvm_stat: Introduce properties for providers

2016-01-11 Thread Janosch Frank
. Herne <jjhe...@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 27 +++ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index 66dfed6..c4

[Qemu-devel] [PATCH v2 21/34] scripts/kvm/kvm_stat: Encapsulate filters variable

2016-01-11 Thread Janosch Frank
, a new function that calls detect_platform and returns the filters was introduced. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scrip

[Qemu-devel] [PATCH v2 33/34] scripts/kvm/kvm_stat: Add interactive filtering

2016-01-11 Thread Janosch Frank
Interactively changing the filter is much more useful than the drilldown, because it is more versatile. With this patch, the filter can be changed by pressing 'f' in the text ui and entering a new filter regex. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kv

[Qemu-devel] [PATCH v2 25/34] scripts/kvm/kvm_stat: Group arch specific data

2016-01-11 Thread Janosch Frank
Using global variables and multiple initialization functions for arch specific data makes the code hard to read. By grouping them in the Arch classes we encapsulate and initialize them in one place. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat

[Qemu-devel] [PATCH v2 23/34] scripts/kvm/kvm_stat: Cleanup of Groups class

2016-01-11 Thread Janosch Frank
Introduced separating newlines for readability and removed special treatment/variable of the group leader. Renamed fmt to read_format. The group leader's file descriptor will not be turned into a file object anymore, instead os.read is used to read from the descriptor. Signed-off-by: Janosch

[Qemu-devel] [PATCH v2 06/34] scripts/kvm/kvm_stat: Invert dictionaries

2016-01-11 Thread Janosch Frank
The exit reasons dictionaries were defined number -> value but later on were accessed the other way around. Therefore a invert function inverted them. Defining them the right way removes the need to invert them and therefore also speeds up the script's setup process. Signed-off-by: Janosch Fr

[Qemu-devel] [PATCH v2 01/34] scripts/kvm/kvm_stat: Cleanup of multiple imports

2016-01-11 Thread Janosch Frank
Removed multiple imports of the same module and moved all imports to the top. It is not necessary to import a module each time one of its functions/classes is used. For readability each import should get its own line. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scrip

[Qemu-devel] [PATCH v2 26/34] scripts/kvm/kvm_stat: Remove unneeded X86_EXIT_REASONS

2016-01-11 Thread Janosch Frank
The architecture detection method directly accesses vmx and smv exit reason constants. Therefore we don't need it anymore. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 5 - 1 file changed, 5 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scrip

[Qemu-devel] [PATCH v2 07/34] scripts/kvm/kvm_stat: Cleanup of path variables

2016-01-11 Thread Janosch Frank
Paths to debugfs and trace dirs are now specified globally to remove redundancies in the code. Reviewed-by: Jason J. Herne <jjhe...@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 14 +++--- 1 file changed, 7 inse

[Qemu-devel] [PATCH v2 24/34] scripts/kvm/kvm_stat: Cleanup of Event class

2016-01-11 Thread Janosch Frank
Added additional newlines for readability. Factored out attribute and event setup code into own methods. Exchanged file() with preferred open(). Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 67 +---

[Qemu-devel] [PATCH v2 00/34] kvm_stat: Cleanup and fixup

2016-01-11 Thread Janosch Frank
. Janosch Frank (34): scripts/kvm/kvm_stat: Cleanup of multiple imports scripts/kvm/kvm_stat: Replaced os.listdir with os.walk scripts/kvm/kvm_stat: Make constants uppercase scripts/kvm/kvm_stat: Removed unneeded PERF constants scripts/kvm/kvm_stat: Mark globals in functions scripts/kvm

[Qemu-devel] [PATCH v2 14/34] scripts/kvm/kvm_stat: Set sensible no. files rlimit

2016-01-11 Thread Janosch Frank
the script runs. Hence we have: cpus * traces + constant Reviewed-by: Jason J. Herne <jjhe...@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a

[Qemu-devel] [PATCH v2 10/34] scripts/kvm/kvm_stat: Fix spaces around keyword assignments

2016-01-11 Thread Janosch Frank
Keyword assignments should not not have spaces around the equal character according to PEP8. Reviewed-by: Jason J. Herne <jjhe...@linux.vnet.ibm.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_stat | 62 ++-

Re: [Qemu-devel] [RFC 3/5] scripts/dump-guest-memory.py: Improve python 3 compatibility

2016-01-15 Thread Janosch Frank
On 01/14/2016 05:03 PM, Laszlo Ersek wrote: > On 01/14/16 09:48, Janosch Frank wrote: >> This commit does not make the script python 3 compatible, it is a >> preparation that fixes the easy and common incompatibilities. >> >> Print is a function in python 3 and theref

[Qemu-devel] [RFC 3/5] scripts/dump-guest-memory.py: Improve python 3 compatibility

2016-01-14 Thread Janosch Frank
. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/dump-guest-memory.py | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/dump-guest-memory.py b/scripts/dump-guest-memory.py index 76a6ecb..fe93135 100644 --- a/scripts/dump

[Qemu-devel] [RFC 1/5] scripts/dump-guest-memory.py: Move constants to the top

2016-01-14 Thread Janosch Frank
The constants bloated the class definition and were therefore moved to the top. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/dump-guest-memory.py | 126 +-- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/s

[Qemu-devel] [RFC 4/5] scripts/dump-guest-memory.py: Cleanup functions

2016-01-14 Thread Janosch Frank
Increase readability by adding newlines and comments, as well as removing wrong whitespaces and C style braces around conditionals and loops. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/dump-guest-memory.py | 71 +++-

[Qemu-devel] [RFC 5/5] scripts/dump-guest-memory.py: Introduce multi-arch support

2016-01-14 Thread Janosch Frank
By modelling the ELF with ctypes we not only gain full python 3 support but can also create dumps for different architectures more easily. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/dump-guest-memory.py | 484 --- 1 file c

[Qemu-devel] [RFC 0/5] scripts/dump-guest-memory.py: Add multi-arch support

2016-01-14 Thread Janosch Frank
. This was tested on a s390 s12 guest only, I'd appreciate tests for the other architectures. Janosch Frank (5): scripts/dump-guest-memory.py: Move constants to the top scripts/dump-guest-memory.py: Make methods functions scripts/dump-guest-memory.py: Improve python 3 compatibility scripts/dump-guest

[Qemu-devel] [RFC 2/5] scripts/dump-guest-memory.py: Make methods functions

2016-01-14 Thread Janosch Frank
The functions dealing with qemu components rarely used parts of the class, so they were moved out of the class. As the uintptr_t variable is needed both within and outside the class, it was made a constant and moved to the top. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.

[Qemu-devel] [PATCH v2] scripts/kvm/kvm_stat: Fix tracefs access checking

2016-02-03 Thread Janosch Frank
') Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- v1 to v2: Exit if -t is set explicitly scripts/kvm/kvm_stat | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat index d43e8f3..4756eee

[Qemu-devel] [PATCH] scripts/kvm/kvm_stat: Fix tracefs access checking

2016-02-02 Thread Janosch Frank
without kernel support, warn with a small timeout, set the debugfs statistics option to True and the tracefs one to False. Fixes: 7aa4ee5 ('scripts/kvm/kvm_stat: Improve debugfs access checking') Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/kvm/kvm_sta

[Qemu-devel] [PATCH] scripts/kvm/kvm_stat: Fix tracefs access checking

2016-02-02 Thread Janosch Frank
to annoy users with longer delays and the message is still visible after closing kvm_stat. Janosch Frank (1): scripts/kvm/kvm_stat: Fix tracefs access checking scripts/kvm/kvm_stat | 20 +++- 1 file changed, 15 insertions(+), 5 deletions(-) -- 2.3.0

[Qemu-devel] [PATCH 2/6] scripts/dump-guest-memory.py: Make methods functions

2016-01-22 Thread Janosch Frank
The functions dealing with qemu components rarely used parts of the class, so they were moved out of the class. As the uintptr_t variable is needed both within and outside the class, it was made a constant and moved to the top. Reviewed-by: Laszlo Ersek <ler...@redhat.com> Signed-off-by: J

[Qemu-devel] [PATCH 0/6] scripts/dump-guest-memory.py: Add multi-arch support

2016-01-22 Thread Janosch Frank
compatibility comment being added in the wrong commit. Fix docstrings that get displayed by gdb. Replaced ceil(len_desc / 4.0) with ((len_desc + 3) // 4) Added patch that fixes module docstring to account for moved gdb help string. Janosch Frank (6): scripts/dump-guest-memory.py: Move

[Qemu-devel] [PATCH 6/6] scripts/dump-guest-memory.py: Fix module docstring

2016-01-22 Thread Janosch Frank
The module docstring is changed into a multi-line comment to comply with pep 257. The comment about the docstring that gets used by gdb to print the help is moved to the location of the docstring. Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/dump-guest-memory.p

[Qemu-devel] [PATCH 1/6] scripts/dump-guest-memory.py: Move constants to the top

2016-01-22 Thread Janosch Frank
The constants bloated the class definition and were therefore moved to the top. Reviewed-by: Laszlo Ersek <ler...@redhat.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/dump-guest-memory.py | 126 +-- 1 file

[Qemu-devel] [PATCH 5/6] scripts/dump-guest-memory.py: Introduce multi-arch support

2016-01-22 Thread Janosch Frank
By modelling the ELF with ctypes we not only gain full python 3 support but can also create dumps for different architectures more easily. Tested-by: Andrew Jones <drjo...@redhat.com> Acked-by: Laszlo Ersek <ler...@redhat.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.co

[Qemu-devel] [PATCH 3/6] scripts/dump-guest-memory.py: Improve python 3 compatibility

2016-01-22 Thread Janosch Frank
. Reviewed-by: Laszlo Ersek <ler...@redhat.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/dump-guest-memory.py | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/scripts/dump-guest-memory.py b/scripts/dump-gue

[Qemu-devel] [PATCH 4/6] scripts/dump-guest-memory.py: Cleanup functions

2016-01-22 Thread Janosch Frank
Increase readability by adding newlines and comments, as well as removing wrong whitespaces and C style braces around conditionals and loops. Reviewed-by: Laszlo Ersek <ler...@redhat.com> Signed-off-by: Janosch Frank <fran...@linux.vnet.ibm.com> --- scripts/dump-guest-me

Re: [Qemu-devel] [RFC 0/5] scripts/dump-guest-memory.py: Add multi-arch support

2016-01-20 Thread Janosch Frank
On 01/18/2016 06:57 PM, Laszlo Ersek wrote: > On 01/18/16 17:31, Andrew Jones wrote: >> On Thu, Jan 14, 2016 at 05:24:23PM +0100, Laszlo Ersek wrote: >>> On 01/14/16 09:48, Janosch Frank wrote: >>>> The dump guest memory script for extracting a Linux core from a qemu

Re: [Qemu-devel] [RFC 3/5] scripts/dump-guest-memory.py: Improve python 3 compatibility

2016-01-20 Thread Janosch Frank
On 01/20/2016 12:18 PM, Paolo Bonzini wrote: > > > On 14/01/2016 09:48, Janosch Frank wrote: >> This commit does not make the script python 3 compatible, it is a >> preparation that fixes the easy and common incompatibilities. >> >> Print is a function in py

Re: [Qemu-devel] [PATCH] scripts/kvm/kvm_stat: Fix missing right parantheses

2016-02-18 Thread Janosch Frank
On 02/17/2016 07:18 AM, Fam Zheng wrote: > Signed-off-by: Fam Zheng > --- > scripts/kvm/kvm_stat | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/scripts/kvm/kvm_stat b/scripts/kvm/kvm_stat > index 3cf1181..517fbec 100755 > --- a/scripts/kvm/kvm_stat >

Re: [Qemu-devel] [PATCH v2] scripts/kvm/kvm_stat: Fix missing right parantheses and ".format(...)"

2016-02-18 Thread Janosch Frank
On 02/19/2016 03:20 AM, Fam Zheng wrote: > They seem to have snuck in when applying Janosch Frank > <fran...@linux.vnet.ibm.com>'s previous patch. > > Signed-off-by: Fam Zheng <f...@redhat.com> > > --- > v2: Also fix .format. [Janosch] > --- > scripts/kvm/

Re: [Qemu-devel] [PATCH] scripts: Fix dump-guest-memory.py for MemoryRegion.ram_block removal

2016-03-08 Thread Janosch Frank
On 03/07/2016 05:35 PM, Janosch Frank wrote: > On 03/07/2016 10:17 AM, Fam Zheng wrote: >> Signed-off-by: Fam Zheng <f...@redhat.com> >> >> --- >> >> This goes after "[PATCH v2 4/7] memory: Drop MemoryRegion.ram_addr" (or >> squashed into it

Re: [Qemu-devel] [PATCH] scripts: Fix dump-guest-memory.py for MemoryRegion.ram_block removal

2016-03-07 Thread Janosch Frank
On 03/07/2016 10:17 AM, Fam Zheng wrote: > Signed-off-by: Fam Zheng > > --- > > This goes after "[PATCH v2 4/7] memory: Drop MemoryRegion.ram_addr" (or > squashed into it if we want strict synchronization). > --- > scripts/dump-guest-memory.py | 2 +- > 1 file changed, 1

Re: [Qemu-devel] Error handling for KVM_GET_DIRTY_LOG

2017-02-20 Thread Janosch Frank
On 20.02.2017 14:46, Paolo Bonzini wrote: > > > On 16/02/2017 15:51, Janosch Frank wrote: >> While trying to fix a bug in the s390 migration code, I noticed that >> QEMU ignores practically all errors returned from that VM ioctl. QEMU >> behaves as specified in the KV

[Qemu-devel] Error handling for KVM_GET_DIRTY_LOG

2017-02-16 Thread Janosch Frank
While trying to fix a bug in the s390 migration code, I noticed that QEMU ignores practically all errors returned from that VM ioctl. QEMU behaves as specified in the KVM api and only processes -1 (-EPERM) as an error. Unfortunately the documentation is wrong/old and KVM may return -EFAULT,

Re: [Qemu-devel] [PATCH 1/3] docker.py: don't hang on large docker output

2016-08-19 Thread Janosch Frank
he output, just send it straight to > /dev/null to avoid this issue. > > Signed-off-by: Sascha Silbe <si...@linux.vnet.ibm.com> Reviewed-by: Janosch Frank <fran...@linux.vnet.ibm.com>

Re: [Qemu-devel] [PATCH 01/11] s390x/kvm: Rework cmma management

2017-07-12 Thread Janosch Frank
On 12.07.2017 15:49, Cornelia Huck wrote: > On Wed, 12 Jul 2017 14:57:35 +0200 > Christian Borntraeger <borntrae...@de.ibm.com> wrote: > >> From: Janosch Frank <fran...@linux.vnet.ibm.com> >> >> Let's keep track of cmma enablement and move the mem_p

Re: [Qemu-devel] [PATCH 5/5] s390x/ccs: add ccw-tester emulated device

2017-09-07 Thread Janosch Frank
[...] > The main problem here is that you want to exercise a middle layer (the > css code) and need to write boilerplate code on both host and guest > side in order to be able to do so. > Nod. > In general, a device that accepts arbitrary channel programs

Re: [Qemu-devel] [PATCH 9/9] iotests.py: use io.StringIO with python3

2017-12-19 Thread Janosch Frank
On 19.12.2017 18:34, Philippe Mathieu-Daudé wrote: > Signed-off-by: Philippe Mathieu-Daudé > --- > tests/qemu-iotests/iotests.py | 7 +-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py > index

  1   2   3   4   5   6   7   8   9   >