linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf machine: Remove condition in machine__get_kernel_start_addr.
@ 2013-11-28 21:55 Dongsheng Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Dongsheng Yang @ 2013-11-28 21:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: eranian, dsahern, adrian.hunter, acme, mingo, paulus,
	a.p.zijlstra, Dongsheng Yang

In machine__get_kernel_start_addr, the code, which is
using machine->root_dir to build filename, works for both
host and guests initialized from guestmount. So this patch
remove the branch for machine__is_host.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 tools/perf/util/machine.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 84cdb07..bac817a 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -502,15 +502,11 @@ static u64 machine__get_kernel_start_addr(struct machine *machine)
 	char path[PATH_MAX];
 	struct process_args args;
 
-	if (machine__is_host(machine)) {
-		filename = "/proc/kallsyms";
-	} else {
-		if (machine__is_default_guest(machine))
-			filename = (char *)symbol_conf.default_guest_kallsyms;
-		else {
-			sprintf(path, "%s/proc/kallsyms", machine->root_dir);
-			filename = path;
-		}
+	if (machine__is_default_guest(machine))
+		filename = (char *)symbol_conf.default_guest_kallsyms;
+	else {
+		sprintf(path, "%s/proc/kallsyms", machine->root_dir);
+		filename = path;
 	}
 
 	if (symbol__restricted_filename(filename, "/proc/kallsyms"))
-- 
1.8.2.1


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

* [PATCH] perf machine: Remove condition in machine__get_kernel_start_addr.
@ 2013-11-28 22:08 Dongsheng Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Dongsheng Yang @ 2013-11-28 22:08 UTC (permalink / raw)
  To: linux-kernel
  Cc: eranian, dsahern, adrian.hunter, acme, mingo, paulus,
	a.p.zijlstra, Dongsheng Yang

In machine__get_kernel_start_addr, the code, which is
using machine->root_dir to build filename, works for both
host and guests initialized from guestmount. So this patch
remove the branch for machine__is_host.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 tools/perf/util/machine.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 84cdb07..bac817a 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -502,15 +502,11 @@ static u64 machine__get_kernel_start_addr(struct machine *machine)
 	char path[PATH_MAX];
 	struct process_args args;
 
-	if (machine__is_host(machine)) {
-		filename = "/proc/kallsyms";
-	} else {
-		if (machine__is_default_guest(machine))
-			filename = (char *)symbol_conf.default_guest_kallsyms;
-		else {
-			sprintf(path, "%s/proc/kallsyms", machine->root_dir);
-			filename = path;
-		}
+	if (machine__is_default_guest(machine))
+		filename = (char *)symbol_conf.default_guest_kallsyms;
+	else {
+		sprintf(path, "%s/proc/kallsyms", machine->root_dir);
+		filename = path;
 	}
 
 	if (symbol__restricted_filename(filename, "/proc/kallsyms"))
-- 
1.8.2.1


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

* Re: [PATCH] perf machine: Remove condition in machine__get_kernel_start_addr.
  2013-11-28 21:47 Dongsheng Yang
@ 2013-11-28 21:51 ` Dongsheng Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Dongsheng Yang @ 2013-11-28 21:51 UTC (permalink / raw)
  To: Dongsheng Yang
  Cc: linux-kernel, eranian, dsahern, adrian.hunter, acme, mingo,
	paulus, a.p.zijlstra


Sorry for the error patch :(, Please ignore it.

On 11/28/2013 04:47 PM, Dongsheng Yang wrote:
> In machine__get_kernel_start_addr, the code, which is
> using machine->root_dir to build filename, works for both
> host and guests initialized from guestmount. So this patch
> remove the branch for machine__is_host.
>
> Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
> ---
>   tools/perf/util/machine.c | 16 ++++++----------
>   1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
> index 84cdb07..52d9161 100644
> --- a/tools/perf/util/machine.c
> +++ b/tools/perf/util/machine.c
> @@ -502,15 +502,11 @@ static u64 machine__get_kernel_start_addr(struct machine *machine)
>   	char path[PATH_MAX];
>   	struct process_args args;
>   
> -	if (machine__is_host(machine)) {
> -		filename = "/proc/kallsyms";
> -	} else {
> -		if (machine__is_default_guest(machine))
> -			filename = (char *)symbol_conf.default_guest_kallsyms;
> -		else {
> -			sprintf(path, "%s/proc/kallsyms", machine->root_dir);
> -			filename = path;
> -		}
> +	if (machine__is_default_guest(machine))
> +		filename = (char *)symbol_conf.default_guest_kallsyms;
> +	else {
> +		sprintf(path, "%s/proc/kallsyms", machine->root_dir);
> +		filename = path;
>   	}
>   
>   	if (symbol__restricted_filename(filename, "/proc/kallsyms"))
> @@ -589,7 +585,7 @@ int machines__create_guest_kernel_maps(struct machines *machines)
>   	if (symbol_conf.default_guest_vmlinux_name ||
>   	    symbol_conf.default_guest_modules ||
>   	    symbol_conf.default_guest_kallsyms) {
> -		machines__create_kernel_maps(machines, DEFAULT_GUEST_KERNEL_ID);
> +		machines__create_kernel_maps(machines, 20315);
>   	}
>   
>   	if (symbol_conf.guestmount) {


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

* [PATCH] perf machine: Remove condition in machine__get_kernel_start_addr.
@ 2013-11-28 21:47 Dongsheng Yang
  2013-11-28 21:51 ` Dongsheng Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Dongsheng Yang @ 2013-11-28 21:47 UTC (permalink / raw)
  To: linux-kernel
  Cc: eranian, dsahern, adrian.hunter, acme, mingo, paulus,
	a.p.zijlstra, Dongsheng Yang

In machine__get_kernel_start_addr, the code, which is
using machine->root_dir to build filename, works for both
host and guests initialized from guestmount. So this patch
remove the branch for machine__is_host.

Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com>
---
 tools/perf/util/machine.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c
index 84cdb07..52d9161 100644
--- a/tools/perf/util/machine.c
+++ b/tools/perf/util/machine.c
@@ -502,15 +502,11 @@ static u64 machine__get_kernel_start_addr(struct machine *machine)
 	char path[PATH_MAX];
 	struct process_args args;
 
-	if (machine__is_host(machine)) {
-		filename = "/proc/kallsyms";
-	} else {
-		if (machine__is_default_guest(machine))
-			filename = (char *)symbol_conf.default_guest_kallsyms;
-		else {
-			sprintf(path, "%s/proc/kallsyms", machine->root_dir);
-			filename = path;
-		}
+	if (machine__is_default_guest(machine))
+		filename = (char *)symbol_conf.default_guest_kallsyms;
+	else {
+		sprintf(path, "%s/proc/kallsyms", machine->root_dir);
+		filename = path;
 	}
 
 	if (symbol__restricted_filename(filename, "/proc/kallsyms"))
@@ -589,7 +585,7 @@ int machines__create_guest_kernel_maps(struct machines *machines)
 	if (symbol_conf.default_guest_vmlinux_name ||
 	    symbol_conf.default_guest_modules ||
 	    symbol_conf.default_guest_kallsyms) {
-		machines__create_kernel_maps(machines, DEFAULT_GUEST_KERNEL_ID);
+		machines__create_kernel_maps(machines, 20315);
 	}
 
 	if (symbol_conf.guestmount) {
-- 
1.8.2.1


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

end of thread, other threads:[~2013-11-28  9:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-28 21:55 [PATCH] perf machine: Remove condition in machine__get_kernel_start_addr Dongsheng Yang
  -- strict thread matches above, loose matches on Subject: below --
2013-11-28 22:08 Dongsheng Yang
2013-11-28 21:47 Dongsheng Yang
2013-11-28 21:51 ` Dongsheng Yang

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).