* [PATCH 0/4] Synchronize libtraceevent with kernel tree
@ 2020-06-22 7:45 Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 1/4] trace-cmd libtraceevent: Remove unneeded semicolon Tzvetomir Stoyanov (VMware)
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2020-06-22 7:45 UTC (permalink / raw)
To: rostedt; +Cc: linux-trace-devel
Backported few traceevent library patches from kernel's tools/lib/traceevent
He Zhe (1):
trace-cmd: traceevent: Take care of return value of asprintf
Hewenliang (1):
trace-cmd traceevent: Fix memory leakage in filter_event
Paolo Bonzini (1):
trace-cmd traceevent: update KVM plugin
Zou Wei (1):
trace-cmd libtraceevent: Remove unneeded semicolon
lib/traceevent/kbuffer-parse.c | 2 +-
lib/traceevent/parse-filter.c | 33 +++++++++++++++++++----------
lib/traceevent/plugins/plugin_kvm.c | 25 +++++++++++++++-------
3 files changed, 40 insertions(+), 20 deletions(-)
--
2.26.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/4] trace-cmd libtraceevent: Remove unneeded semicolon
2020-06-22 7:45 [PATCH 0/4] Synchronize libtraceevent with kernel tree Tzvetomir Stoyanov (VMware)
@ 2020-06-22 7:45 ` Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 2/4] trace-cmd traceevent: Fix memory leakage in filter_event Tzvetomir Stoyanov (VMware)
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2020-06-22 7:45 UTC (permalink / raw)
To: rostedt; +Cc: linux-trace-devel
From: Zou Wei <zou_wei@huawei.com>
Fixes coccicheck warning:
tools/lib/traceevent/kbuffer-parse.c:441:2-3: Unneeded semicolon
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
Acked-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Link: http://lore.kernel.org/lkml/1588065121-71236-1-git-send-email-zou_wei@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
lib/traceevent/kbuffer-parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/traceevent/kbuffer-parse.c b/lib/traceevent/kbuffer-parse.c
index b18dedc4..2c5f00a9 100644
--- a/lib/traceevent/kbuffer-parse.c
+++ b/lib/traceevent/kbuffer-parse.c
@@ -439,7 +439,7 @@ void *kbuffer_translate_data(int swap, void *data, unsigned int *size)
case KBUFFER_TYPE_TIME_EXTEND:
case KBUFFER_TYPE_TIME_STAMP:
return NULL;
- };
+ }
*size = length;
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/4] trace-cmd traceevent: Fix memory leakage in filter_event
2020-06-22 7:45 [PATCH 0/4] Synchronize libtraceevent with kernel tree Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 1/4] trace-cmd libtraceevent: Remove unneeded semicolon Tzvetomir Stoyanov (VMware)
@ 2020-06-22 7:45 ` Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 3/4] trace-cmd: traceevent: Take care of return value of asprintf Tzvetomir Stoyanov (VMware)
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2020-06-22 7:45 UTC (permalink / raw)
To: rostedt; +Cc: linux-trace-devel
From: Hewenliang <hewenliang4@huawei.com>
It is necessary to call free_arg(arg) when add_filter_type() returns NULL
in filter_event().
Signed-off-by: Hewenliang <hewenliang4@huawei.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Feilong Lin <linfeilong@huawei.com>
Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Link: http://lore.kernel.org/lkml/20191209063549.59941-1-hewenliang4@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
lib/traceevent/parse-filter.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/traceevent/parse-filter.c b/lib/traceevent/parse-filter.c
index f3cbf86e..20eed719 100644
--- a/lib/traceevent/parse-filter.c
+++ b/lib/traceevent/parse-filter.c
@@ -1228,8 +1228,10 @@ filter_event(struct tep_event_filter *filter, struct tep_event *event,
}
filter_type = add_filter_type(filter, event->id);
- if (filter_type == NULL)
+ if (filter_type == NULL) {
+ free_arg(arg);
return TEP_ERRNO__MEM_ALLOC_FAILED;
+ }
if (filter_type->filter)
free_arg(filter_type->filter);
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/4] trace-cmd: traceevent: Take care of return value of asprintf
2020-06-22 7:45 [PATCH 0/4] Synchronize libtraceevent with kernel tree Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 1/4] trace-cmd libtraceevent: Remove unneeded semicolon Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 2/4] trace-cmd traceevent: Fix memory leakage in filter_event Tzvetomir Stoyanov (VMware)
@ 2020-06-22 7:45 ` Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 4/4] trace-cmd traceevent: update KVM plugin Tzvetomir Stoyanov (VMware)
2020-06-22 13:44 ` [PATCH 0/4] Synchronize libtraceevent with kernel tree Steven Rostedt
4 siblings, 0 replies; 6+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2020-06-22 7:45 UTC (permalink / raw)
To: rostedt; +Cc: linux-trace-devel
From: He Zhe <zhe.he@windriver.com>
According to the API, if memory allocation wasn't possible, or some
other error occurs, asprintf will return -1, and the contents of strp
below are undefined.
int asprintf(char **strp, const char *fmt, ...);
This patch takes care of return value of asprintf to make it less error
prone and prevent the following build warning.
ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
Signed-off-by: He Zhe <zhe.he@windriver.com>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Tzvetomir Stoyanov <tstoyanov@vmware.com>
Cc: hewenliang4@huawei.com
Link: http://lore.kernel.org/lkml/1582163930-233692-1-git-send-email-zhe.he@windriver.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
lib/traceevent/parse-filter.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/lib/traceevent/parse-filter.c b/lib/traceevent/parse-filter.c
index 20eed719..c271aeeb 100644
--- a/lib/traceevent/parse-filter.c
+++ b/lib/traceevent/parse-filter.c
@@ -1958,7 +1958,8 @@ static char *op_to_str(struct tep_event_filter *filter, struct tep_filter_arg *a
default:
break;
}
- asprintf(&str, val ? "TRUE" : "FALSE");
+ if (asprintf(&str, val ? "TRUE" : "FALSE") < 0)
+ str = NULL;
break;
}
}
@@ -1976,7 +1977,8 @@ static char *op_to_str(struct tep_event_filter *filter, struct tep_filter_arg *a
break;
}
- asprintf(&str, "(%s) %s (%s)", left, op, right);
+ if (asprintf(&str, "(%s) %s (%s)", left, op, right) < 0)
+ str = NULL;
break;
case TEP_FILTER_OP_NOT:
@@ -1992,10 +1994,12 @@ static char *op_to_str(struct tep_event_filter *filter, struct tep_filter_arg *a
right_val = 0;
if (right_val >= 0) {
/* just return the opposite */
- asprintf(&str, right_val ? "FALSE" : "TRUE");
+ if (asprintf(&str, right_val ? "FALSE" : "TRUE") < 0)
+ str = NULL;
break;
}
- asprintf(&str, "%s(%s)", op, right);
+ if (asprintf(&str, "%s(%s)", op, right) < 0)
+ str = NULL;
break;
default:
@@ -2011,7 +2015,8 @@ static char *val_to_str(struct tep_event_filter *filter, struct tep_filter_arg *
{
char *str = NULL;
- asprintf(&str, "%lld", arg->value.val);
+ if (asprintf(&str, "%lld", arg->value.val) < 0)
+ str = NULL;
return str;
}
@@ -2069,7 +2074,8 @@ static char *exp_to_str(struct tep_event_filter *filter, struct tep_filter_arg *
break;
}
- asprintf(&str, "%s %s %s", lstr, op, rstr);
+ if (asprintf(&str, "%s %s %s", lstr, op, rstr) < 0)
+ str = NULL;
out:
free(lstr);
free(rstr);
@@ -2113,7 +2119,8 @@ static char *num_to_str(struct tep_event_filter *filter, struct tep_filter_arg *
if (!op)
op = "<=";
- asprintf(&str, "%s %s %s", lstr, op, rstr);
+ if (asprintf(&str, "%s %s %s", lstr, op, rstr) < 0)
+ str = NULL;
break;
default:
@@ -2148,8 +2155,9 @@ static char *str_to_str(struct tep_event_filter *filter, struct tep_filter_arg *
if (!op)
op = "!~";
- asprintf(&str, "%s %s \"%s\"",
- arg->str.field->name, op, arg->str.val);
+ if (asprintf(&str, "%s %s \"%s\"",
+ arg->str.field->name, op, arg->str.val) < 0)
+ str = NULL;
break;
default:
@@ -2165,7 +2173,8 @@ static char *arg_to_str(struct tep_event_filter *filter, struct tep_filter_arg *
switch (arg->type) {
case TEP_FILTER_ARG_BOOLEAN:
- asprintf(&str, arg->boolean.value ? "TRUE" : "FALSE");
+ if (asprintf(&str, arg->boolean.value ? "TRUE" : "FALSE") < 0)
+ str = NULL;
return str;
case TEP_FILTER_ARG_OP:
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 4/4] trace-cmd traceevent: update KVM plugin
2020-06-22 7:45 [PATCH 0/4] Synchronize libtraceevent with kernel tree Tzvetomir Stoyanov (VMware)
` (2 preceding siblings ...)
2020-06-22 7:45 ` [PATCH 3/4] trace-cmd: traceevent: Take care of return value of asprintf Tzvetomir Stoyanov (VMware)
@ 2020-06-22 7:45 ` Tzvetomir Stoyanov (VMware)
2020-06-22 13:44 ` [PATCH 0/4] Synchronize libtraceevent with kernel tree Steven Rostedt
4 siblings, 0 replies; 6+ messages in thread
From: Tzvetomir Stoyanov (VMware) @ 2020-06-22 7:45 UTC (permalink / raw)
To: rostedt; +Cc: linux-trace-devel
From: Paolo Bonzini <pbonzini@redhat.com>
The format of the role word has changed through the years and the plugin
was never updated; some VMX exit reasons were missing too.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: kvm@vger.kernel.org
Link: http://lkml.kernel.org/r/1443695293-31127-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
lib/traceevent/plugins/plugin_kvm.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/lib/traceevent/plugins/plugin_kvm.c b/lib/traceevent/plugins/plugin_kvm.c
index 6c744328..f9f12e57 100644
--- a/lib/traceevent/plugins/plugin_kvm.c
+++ b/lib/traceevent/plugins/plugin_kvm.c
@@ -110,7 +110,10 @@ static const char *disassemble(unsigned char *insn, int len, uint64_t rip,
_ER(WBINVD, 54) \
_ER(XSETBV, 55) \
_ER(APIC_WRITE, 56) \
- _ER(INVPCID, 58)
+ _ER(INVPCID, 58) \
+ _ER(PML_FULL, 62) \
+ _ER(XSAVES, 63) \
+ _ER(XRSTORS, 64)
#define SVM_EXIT_REASONS \
_ER(EXIT_READ_CR0, 0x000) \
@@ -357,15 +360,18 @@ static int kvm_nested_vmexit_handler(struct trace_seq *s, struct tep_record *rec
union kvm_mmu_page_role {
unsigned word;
struct {
- unsigned glevels:4;
unsigned level:4;
+ unsigned cr4_pae:1;
unsigned quadrant:2;
- unsigned pad_for_nice_hex_output:6;
unsigned direct:1;
unsigned access:3;
unsigned invalid:1;
- unsigned cr4_pge:1;
unsigned nxe:1;
+ unsigned cr0_wp:1;
+ unsigned smep_and_not_wp:1;
+ unsigned smap_and_not_wp:1;
+ unsigned pad_for_nice_hex_output:8;
+ unsigned smm:8;
};
};
@@ -389,15 +395,18 @@ static int kvm_mmu_print_role(struct trace_seq *s, struct tep_record *record,
if (tep_is_file_bigendian(event->tep) ==
tep_is_local_bigendian(event->tep)) {
- trace_seq_printf(s, "%u/%u q%u%s %s%s %spge %snxe",
+ trace_seq_printf(s, "%u q%u%s %s%s %spae %snxe %swp%s%s%s",
role.level,
- role.glevels,
role.quadrant,
role.direct ? " direct" : "",
access_str[role.access],
role.invalid ? " invalid" : "",
- role.cr4_pge ? "" : "!",
- role.nxe ? "" : "!");
+ role.cr4_pae ? "" : "!",
+ role.nxe ? "" : "!",
+ role.cr0_wp ? "" : "!",
+ role.smep_and_not_wp ? " smep" : "",
+ role.smap_and_not_wp ? " smap" : "",
+ role.smm ? " smm" : "");
} else
trace_seq_printf(s, "WORD: %08x", role.word);
--
2.26.2
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/4] Synchronize libtraceevent with kernel tree
2020-06-22 7:45 [PATCH 0/4] Synchronize libtraceevent with kernel tree Tzvetomir Stoyanov (VMware)
` (3 preceding siblings ...)
2020-06-22 7:45 ` [PATCH 4/4] trace-cmd traceevent: update KVM plugin Tzvetomir Stoyanov (VMware)
@ 2020-06-22 13:44 ` Steven Rostedt
4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-06-22 13:44 UTC (permalink / raw)
To: Tzvetomir Stoyanov (VMware); +Cc: linux-trace-devel
On Mon, 22 Jun 2020 10:45:50 +0300
"Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote:
> Backported few traceevent library patches from kernel's tools/lib/traceevent
>
> He Zhe (1):
> trace-cmd: traceevent: Take care of return value of asprintf
>
> Hewenliang (1):
> trace-cmd traceevent: Fix memory leakage in filter_event
>
> Paolo Bonzini (1):
> trace-cmd traceevent: update KVM plugin
>
> Zou Wei (1):
> trace-cmd libtraceevent: Remove unneeded semicolon
>
Hi Tzvetomir,
Thanks for doing this, but as you did the backporting, it is still
required that you add your "Signed-off-by" to the bottom of each patch.
Cheers!
-- Steve
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-06-22 13:44 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22 7:45 [PATCH 0/4] Synchronize libtraceevent with kernel tree Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 1/4] trace-cmd libtraceevent: Remove unneeded semicolon Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 2/4] trace-cmd traceevent: Fix memory leakage in filter_event Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 3/4] trace-cmd: traceevent: Take care of return value of asprintf Tzvetomir Stoyanov (VMware)
2020-06-22 7:45 ` [PATCH 4/4] trace-cmd traceevent: update KVM plugin Tzvetomir Stoyanov (VMware)
2020-06-22 13:44 ` [PATCH 0/4] Synchronize libtraceevent with kernel tree Steven Rostedt
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).