kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] trace-cmd: Fix reporting of unknown SVM exit reasons
@ 2016-05-22 16:02 Jan Kiszka
  2016-05-31 15:23 ` Steven Rostedt
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Kiszka @ 2016-05-22 16:02 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Linux Kernel Mailing List, kvm


[-- Attachment #1.1: Type: text/plain, Size: 1065 bytes --]

From: Jan Kiszka <jan.kiszka@siemens.com>

On AMD, exist code -1 is also a possible value, but we use it for
terminating the list of known exit reasons. This leads to EXIT_ERR
being reported for unkown ones. Fix this by using an NULL string
pointer as terminal.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 plugin_kvm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugin_kvm.c b/plugin_kvm.c
index 15a6f4c..99e920f 100644
--- a/plugin_kvm.c
+++ b/plugin_kvm.c
@@ -208,12 +208,12 @@ struct str_values {
 
 static struct str_values vmx_exit_reasons[] = {
 	VMX_EXIT_REASONS
-	{ NULL, -1}
+	{ }
 };
 
 static struct str_values svm_exit_reasons[] = {
 	SVM_EXIT_REASONS
-	{ NULL, -1}
+	{ }
 };
 
 static struct isa_exit_reasons {
@@ -237,7 +237,7 @@ static const char *find_exit_reason(unsigned isa, int val)
 		}
 	if (!strings)
 		return "UNKNOWN-ISA";
-	for (i = 0; strings[i].val >= 0; i++)
+	for (i = 0; strings[i].str; i++)
 		if (strings[i].val == val)
 			break;
 
-- 
2.6.6


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] trace-cmd: Fix reporting of unknown SVM exit reasons
  2016-05-22 16:02 [PATCH] trace-cmd: Fix reporting of unknown SVM exit reasons Jan Kiszka
@ 2016-05-31 15:23 ` Steven Rostedt
  2016-06-01 10:06   ` Jan Kiszka
  0 siblings, 1 reply; 3+ messages in thread
From: Steven Rostedt @ 2016-05-31 15:23 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Linux Kernel Mailing List, kvm

On Sun, 22 May 2016 18:02:31 +0200
Jan Kiszka <jan.kiszka@web.de> wrote:

Hi Jan,

I finally got around to looking at your patches (not much to do on a 12
hour layover :-p).

> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> On AMD, exist code -1 is also a possible value, but we use it for
> terminating the list of known exit reasons. This leads to EXIT_ERR
> being reported for unkown ones. Fix this by using an NULL string
> pointer as terminal.
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>  plugin_kvm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/plugin_kvm.c b/plugin_kvm.c
> index 15a6f4c..99e920f 100644
> --- a/plugin_kvm.c
> +++ b/plugin_kvm.c
> @@ -208,12 +208,12 @@ struct str_values {
>  
>  static struct str_values vmx_exit_reasons[] = {
>  	VMX_EXIT_REASONS
> -	{ NULL, -1}
> +	{ }

Just a preference, but I would rather this still explicitly show the
NULL. The second value is meaningless with the change below. Thus, I'm
going to nuke these two hunks and just add the last one, which should
still work for you.

If not, let me know, or just tell me this weekend ;-) (I wont be
pushing this to my main server till I get back anyway)

-- Steve

>  };
>  
>  static struct str_values svm_exit_reasons[] = {
>  	SVM_EXIT_REASONS
> -	{ NULL, -1}
> +	{ }
>  };
>  
>  static struct isa_exit_reasons {
> @@ -237,7 +237,7 @@ static const char *find_exit_reason(unsigned isa, int val)
>  		}
>  	if (!strings)
>  		return "UNKNOWN-ISA";
> -	for (i = 0; strings[i].val >= 0; i++)
> +	for (i = 0; strings[i].str; i++)
>  		if (strings[i].val == val)
>  			break;
>  

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] trace-cmd: Fix reporting of unknown SVM exit reasons
  2016-05-31 15:23 ` Steven Rostedt
@ 2016-06-01 10:06   ` Jan Kiszka
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Kiszka @ 2016-06-01 10:06 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: Linux Kernel Mailing List, kvm

On 2016-05-31 17:23, Steven Rostedt wrote:
> On Sun, 22 May 2016 18:02:31 +0200
> Jan Kiszka <jan.kiszka@web.de> wrote:
> 
> Hi Jan,
> 
> I finally got around to looking at your patches (not much to do on a 12
> hour layover :-p).
> 
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> On AMD, exist code -1 is also a possible value, but we use it for
>> terminating the list of known exit reasons. This leads to EXIT_ERR
>> being reported for unkown ones. Fix this by using an NULL string
>> pointer as terminal.
>>
>> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
>> ---
>>  plugin_kvm.c | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/plugin_kvm.c b/plugin_kvm.c
>> index 15a6f4c..99e920f 100644
>> --- a/plugin_kvm.c
>> +++ b/plugin_kvm.c
>> @@ -208,12 +208,12 @@ struct str_values {
>>  
>>  static struct str_values vmx_exit_reasons[] = {
>>  	VMX_EXIT_REASONS
>> -	{ NULL, -1}
>> +	{ }
> 
> Just a preference, but I would rather this still explicitly show the
> NULL. The second value is meaningless with the change below. Thus, I'm
> going to nuke these two hunks and just add the last one, which should
> still work for you.

Fine for me.

Thanks,
Jan

> 
> If not, let me know, or just tell me this weekend ;-) (I wont be
> pushing this to my main server till I get back anyway)
> 
> -- Steve
> 
>>  };
>>  
>>  static struct str_values svm_exit_reasons[] = {
>>  	SVM_EXIT_REASONS
>> -	{ NULL, -1}
>> +	{ }
>>  };
>>  
>>  static struct isa_exit_reasons {
>> @@ -237,7 +237,7 @@ static const char *find_exit_reason(unsigned isa, int val)
>>  		}
>>  	if (!strings)
>>  		return "UNKNOWN-ISA";
>> -	for (i = 0; strings[i].val >= 0; i++)
>> +	for (i = 0; strings[i].str; i++)
>>  		if (strings[i].val == val)
>>  			break;
>>  
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-06-01 10:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-22 16:02 [PATCH] trace-cmd: Fix reporting of unknown SVM exit reasons Jan Kiszka
2016-05-31 15:23 ` Steven Rostedt
2016-06-01 10:06   ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).