Skip to contentSkip to conversation

xenoprof: preliminary patches for xenoprof/ia64

PATCH In review Isaku Yamahata 3 participants 24 messages Nov 14, 2006 – Nov 22, 2006

lore
Share & tools
lore
#0 lore raw

cover xenoprof: preliminary patches for xenoprof/ia64

Those patches are preliminary clean-ups to support xenoprof on ia64. They split the current x86-specific code into arch dependent/independent code and make them more arch-generic.
Those include also bug fixes, clean-ups and dynamic mapping/unmapping xenoprof buffer support. I'll post the IA64 part to xen-ia64-devel.

[PATCH 1/5] xenoprof: split xen x86 xenoprof code [PATCH 2/5] xenoprof: make xen xenoprof code slight arch-generic [PATCH 3/5] xenoprof: split linux x86 xenoprof code [PATCH 4/5] xenoprof: make linux xenoprof code arch-generic [PATCH 5/5] xenoprof: make xen xenoprof code arch-generic

Changes:

TAKE 2
- broke patches into smaller ones for review.
The final code is almost same as TAKE 1.

thanks
yamahata

#1 lore raw

PATCH 1/5 xenoprof: split xen x86 xenoprof code

# HG changeset patch
# User [email protected]
# Date 1163486059 -32400
# Node ID 24e1dacab1545640701709be7742608de73063cc
# Parent 45d6a5bc857817fb8f541b410920e59bf1417ac2
move xenoprof code under xen/arch/x86/oprofile to xen/common without code changes excpet slight adjustment to compile.
PATCHNAME: move_xen_x86_xenoprof_code_under_xen_common

xen/arch/x86/Rules.mk +1 -0
diff -r 45d6a5bc8578 -r 24e1dacab154 xen/arch/x86/Rules.mk
@@ -3,6 +3,7 @@
 
 HAS_ACPI := y
 HAS_VGA  := y
+xenoprof := y
 
 #
 # If you change any of these configuration options then you must
xen/arch/x86/oprofile/xenoprof.c +4 -687

703 lines not on this page · raw message

xen/common/Makefile +1 -0
diff -r 45d6a5bc8578 -r 24e1dacab154 xen/common/Makefile
@@ -29,6 +29,7 @@ obj-y += xmalloc.o
 
 obj-$(perfc)       += perfc.o
 obj-$(crash_debug) += gdbstub.o
+obj-$(xenoprof)    += xenoprof.o
 
 # Object file contains changeset and compiler information.
 version.o: $(BASEDIR)/include/xen/compile.h
xen/common/xenoprof.c new file +706 -0

706 lines not on this page · raw message

yamahata

#2 lore raw

RE: [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

xen/arch/x86/Rules.mk

Quoted 27 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Isaku Yamahata
Sent: Monday, November 13, 2006 11:02 PM
To: [email protected]; Isaku Yamahata
Cc: Isaku Yamahata; [email protected]
Subject: [Xen-devel] [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

# HG changeset patch
# User [email protected]
# Date 1163486059 -32400
# Node ID 24e1dacab1545640701709be7742608de73063cc # Parent 45d6a5bc857817fb8f541b410920e59bf1417ac2 move xenoprof code under xen/arch/x86/oprofile to xen/common without code changes excpet slight adjustment to compile.
PATCHNAME: move_xen_x86_xenoprof_code_under_xen_common

diff -r 45d6a5bc8578 -r 24e1dacab154 xen/arch/x86/Rules.mk

xen/arch/x86/Rules.mk +0 -0
@@ -3,6 +3,7 @@

<deleted>

xen/common/Makefile obj-y += xmalloc.o

Quoted 6 lines
xen/arch/x86/Rules.mk +0 -0
 int xenoprofile_get_mode(struct vcpu *v, struct 

cpu_user_regs * const regs) { diff -r 45d6a5bc8578 -r 24e1dacab154 xen/common/Makefile

xen/common/Makefile +0 -0
@@ -29,6 +29,7 @@ obj-y += xmalloc.o

Isaku,

This patch is corrupt. It does not apply cleanly. It has several missing "newlines" such as for example the line above.
Could you please regenerate ?
I am not sure about the other patches, but it would help if you can make sure they are all OK and resend.

Thanks
Renato

#3 lore raw

Re: [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

Quoted 5 lines · Jose Renato G

This patch is corrupt. It does not apply cleanly. It has several missing "newlines" such as for example the line above.
Could you please regenerate ?
I am not sure about the other patches, but it would help if you can make sure they are all OK and resend.

I regenerated them for 12446:fb107b9eee86 of xen-unstable.hg. They should apply cleanly and compile.
To make sure not to corrupt the patches, I attached them as a tar ball. Please find it.

Signature · 1 line
yamahata

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#4 lore raw

RE: [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

Isaku,

Mostly, the patches look good.
I have a few questions though , mostly for clarification

Keir,

Could you please wait until I have a chance to test the patches on my machine before applying.
I will be out all day tomorrow (Thursday) to attend an external event so I will only be able to do this on Friday.
Also, I think it would be good if you could review parts of patch 5. There are some changes on how xenoprof shares page with the guest. The patch decouples the code for allocating xenoprof buffer from the code for sharing it with the domain. This is very welcome as it has been on my wish list for a while. This modification should remove the current limitation that guests cannot use different profiling modes (active and passive) in different profiling sessions. But I am afraid I do not understand Xen memory management in detail to review this part of the patch. Please, take a look.

-----------------------
QUESTIONS for Isaku:

patch 4/5:
==========

Review

Quoted 4 lines
(quoted diff) +4 -0
+struct xenoprof_shared_buffer {
+	char					*buffer;
+	struct xenoprof_arch_shared_buffer	arch;
+};

The arch field has no extra info for x86. Why do you need this?

Review static int __init init_driverfs(void) · line 104

Quoted 9 lines
(quoted diff) +1 -1
@@ -103,7 +98,7 @@ static int __init init_driverfs(void)
 }
 
 
-static void __exit exit_driverfs(void)
+static void /* __exit */ exit_driverfs(void)
 {
 	sysdev_unregister(&device_oprofile);
 	sysdev_class_unregister(&oprofile_sysclass);

Why removing "__exit" is needed?

xen/common/xenoprof.c line 64

Quoted 10 lines
xen/common/xenoprof.c new file +10 -0
+void xenoprof_arch_start(void) 
+{
+	/* nothing */
+}
+
+void xenoprof_arch_stop(void)
+{
+	/* nothing */
+}
+

Why do we need arch specific functions for start and stop?

Quoted 4 lines
(quoted diff) +0 -0
@@ -22,9 +22,25 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__

Review line 33

Quoted 10 lines
(quoted diff) +6 -1
+
 #ifdef CONFIG_OPROFILE
-
 #include <asm/xenoprof.h>
 
+struct oprofile_operations;
+int xenoprofile_init(struct oprofile_operations * ops);
+void xenoprofile_exit(void);
+
+// for perfmon/xen

Please drop the comment or change it (xenoprofile is not using perfmon)

patch 5/5:
=========

Review line 34

Quoted 2 lines
(quoted diff) +1 -1
-static char *alloc_xenoprof_buf(struct domain *d, int npages)
+static char *alloc_xenoprof_buf(struct domain *d, int npages,

uint64_t gmaddr)

The extra parameter gmaddr is not needed since if it is not used by the function.

Regards

Renato

Quoted 25 lines
(quoted diff) +0 -1
-----Original Message-----

From: Isaku Yamahata [mailto:[email protected]]
Sent: Tuesday, November 14, 2006 6:14 PM
To: Santos, Jose Renato G
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

Quoted 5 lines · Jose Renato G

This patch is corrupt. It does not apply cleanly. It has several missing "newlines" such as for example the line above. Could you please regenerate ?
I am not sure about the other patches, but it would help if you can make sure they are all OK and resend.

I regenerated them for 12446:fb107b9eee86 of xen-unstable.hg. They should apply cleanly and compile.
To make sure not to corrupt the patches, I attached them as a tar ball.
Please find it.

--
yamahata

#5 lore raw

Re: [Xen-devel] [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

Quoted 2 lines · Jose Renato G

Mostly, the patches look good.
I have a few questions though , mostly for clarification

Thank you for your review.

Quoted 11 lines

QUESTIONS for Isaku:

patch 4/5:
==========

Review

Quoted 4 lines
(quoted diff) +4 -0
+struct xenoprof_shared_buffer {
+	char					*buffer;
+	struct xenoprof_arch_shared_buffer	arch;
+};

The arch field has no extra info for x86. Why do you need this?

On IA64 it is defined as

struct xenoprof_arch_shared_buffer {
        struct resource*        res;
};

On IA64, auto translated mode feature is enabled.
It means that page mapping from xen is based on pseudo physical address, not virtual address. Pseudo physical address used to map pages must be recorded somewhere in order to unmap.
I guess, if xenoprof/x86 supported auto translated guest mode something similar structure would be necessary.

Quoted 11 lines

Review static int __init init_driverfs(void) · line 104

Quoted 9 lines
(quoted diff) +1 -1
@@ -103,7 +98,7 @@ static int __init init_driverfs(void)
 }
 
 
-static void __exit exit_driverfs(void)
+static void /* __exit */ exit_driverfs(void)
 {
 	sysdev_unregister(&device_oprofile);
 	sysdev_class_unregister(&oprofile_sysclass);

Why removing "__exit" is needed?

Because it is called by non-"__exit" function.
__init oprofile_init()
=> oprofile_arch_exit() // error recovery

     => xenoprof_arch_exit()
        => exit_driver()

When I compiled xenLinux/IA64, linker complained.
I suspect that "__exit" of the original oprofile_arch_exit() of linux-2.6-xen-sparse/arch/i386/oprofile/xenropof.c is wrong. Actually the vanilla oprofile_arch_exit() of linux/arch/i386/oprofile/init.c doesn't carry "__exit". Gcc didn't complain when I compiled xenLinux/i386, though.

Quoted 4 lines
Quoted 4 lines
xen/common/xenoprof.c new file +4 -0
+void xenoprof_arch_start(void) 
+{
+	/* nothing */
+}
Quoted 8 lines

xen/common/xenoprof.c line 58

Quoted 6 lines
xen/common/xenoprof.c new file +6 -0
+
+void xenoprof_arch_stop(void)
+{
+	/* nothing */
+}
+

Why do we need arch specific functions for start and stop?

On IA64 they are defined as
void xenoprof_arch_start(void)

{
        perfmon_start();
}

void xenoprof_arch_stop(void)

{
        perfmon_stop();
}

struct op_counter_config is x86 specific. I chose to define op_counter_config related operation as nop on IA64 and
to add those two hooks.
On IA64, registers related to performance monitoring are manipulated through perfmonctl system call.
The oprofile/ia64 doesn't manipulate them directly.
It just tells perfmon to start/stop. So those hooks are needed.

It would be possible to define more generic interface to manipulated performance monitoring registers.
Actually the perfmon project is working on that and the effort is under way.
(It is held by hp lab so that you may already know that though.) I think it is too eary to do so for xenoprof.

Quoted 9 lines
Quoted 9 lines
(quoted diff) +1 -1
@@ -22,9 +22,25 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__
+
 #ifdef CONFIG_OPROFILE
-
 #include <asm/xenoprof.h>
 
Quoted 7 lines

Review line 33

Quoted 5 lines
(quoted diff) +5 -0
+struct oprofile_operations;
+int xenoprofile_init(struct oprofile_operations * ops);
+void xenoprofile_exit(void);
+
+// for perfmon/xen

Please drop the comment or change it (xenoprofile is not using perfmon)

I'll drop it.

Quoted 9 lines

patch 5/5:
=========

Review line 34

Quoted 2 lines
(quoted diff) +1 -1
-static char *alloc_xenoprof_buf(struct domain *d, int npages)
+static char *alloc_xenoprof_buf(struct domain *d, int npages,

uint64_t gmaddr)

The extra parameter gmaddr is not needed since if it is not used by the function.

I'll remove it.

Signature · 1 line
yamahata
#6 lore raw

RE: [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

Quoted 36 lines

-----Original Message-----
From: Isaku Yamahata [mailto:[email protected]]
Sent: Wednesday, November 15, 2006 9:54 PM
To: Santos, Jose Renato G
Cc: Keir Fraser; [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

Quoted 2 lines · Jose Renato G

Mostly, the patches look good.
I have a few questions though , mostly for clarification

Thank you for your review.

Quoted 11 lines

QUESTIONS for Isaku:

patch 4/5:
==========

Review

Quoted 4 lines
(quoted diff) +4 -0
+struct xenoprof_shared_buffer {
+	char					*buffer;
+	struct xenoprof_arch_shared_buffer	arch;
+};

The arch field has no extra info for x86. Why do you need this?

On IA64 it is defined as

struct xenoprof_arch_shared_buffer {
        struct resource*        res;
};
Quoted 9 lines

On IA64, auto translated mode feature is enabled. It means that page mapping from xen is based on pseudo physical address, not virtual address. Pseudo physical address used to map pages must be recorded somewhere in order to unmap.
I guess, if xenoprof/x86 supported auto translated guest mode something similar structure would be necessary.

Isaku

I am still not convinced that we need this. Since this in the kernel
you can always get the pseudo physical address from the virtual address, right? Am I missing something?

I applied your patches to changeset 12446 but they are failing to
compile. I have attached the make output below

Could you please fix this and resend?

Thanks

Renato

========================================================================
============
CC [M] arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.o
arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:45:
error: array type has incomplete element type arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c: In function "unmap_passive_list":
arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:242:
warning: implicit declaration of function "xenoprof_arch_unmap_shared_buffer" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c: In function "map_xenoprof_buffer":
arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:253:
error: invalid use of undefined type "struct xenoprof_shared_buffer" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:257:
warning: implicit declaration of function "xenoprof_arch_map_shared_buffer" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:264:
error: invalid use of undefined type "struct xenoprof_shared_buffer" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c: In function "xenoprof_setup":
arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:300:
warning: implicit declaration of function "xenoprof_arch_counter" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c: In function "xenoprof_start":
arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:345:
warning: implicit declaration of function "xenoprof_arch_start" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c: In function "xenoprof_stop":
arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:354:
warning: implicit declaration of function "xenoprof_arch_stop" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c: In function "xenoprof_set_passive":
arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:422:
warning: implicit declaration of function "xenoprof_arch_set_passive" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c: At top level:
arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:460:
error: syntax error before "do" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:465:
warning: type defaults to "int" in declaration of "ret" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:465:
error: "init" undeclared here (not in a function) arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:465:
error: initializer element is not constant arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:465:
warning: data definition has no type or storage class arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:466:
error: syntax error before "if" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:468:
warning: type defaults to "int" in declaration of "xenoprof_is_primary" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:468:
error: redefinition of "xenoprof_is_primary" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:51:
error: previous definition of "xenoprof_is_primary" was here arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:468:
warning: data definition has no type or storage class arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:471:
warning: type defaults to "int" in declaration of "cpu_type" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:471:
error: conflicting types for "cpu_type" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:59:
error: previous declaration of "cpu_type" was here arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:471:
error: invalid initializer arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:471:
warning: data definition has no type or storage class arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:472:
error: syntax error before "." token arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:472:
warning: type defaults to "int" in declaration of "strncpy" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:472:
warning: function declaration isn"t a prototype arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:472:
error: conflicting types for "strncpy" include/asm/string.h:45: error: previous definition of "strncpy" was here arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:472:
warning: data definition has no type or storage class arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:473:
error: syntax error before "." token arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:475:
warning: type defaults to "int" in declaration of "init_driverfs" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:475:
warning: function declaration isn"t a prototype arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:475:
warning: data definition has no type or storage class arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:476:
warning: type defaults to "int" in declaration of "using_xenoprof" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:476:
error: non-static declaration of "using_xenoprof" follows static declaration arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:458:
error: previous declaration of "using_xenoprof" was here arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:476:
warning: data definition has no type or storage class arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:477:
warning: type defaults to "int" in declaration of "ops" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:477:
error: incompatible types in initialization arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:477:
warning: data definition has no type or storage class arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:479:
error: syntax error before "for" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:482:
warning: type defaults to "int" in declaration of "active_defined" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:482:
error: non-static declaration of "active_defined" follows static declaration arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:52:
error: previous declaration of "active_defined" was here arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:482:
warning: data definition has no type or storage class arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:483:
error: syntax error before "}" token arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:484:
error: syntax error before string constant arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:485:
warning: type defaults to "int" in declaration of "printk" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:485:
warning: function declaration isn"t a prototype arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:485:
error: conflicting types for "printk" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:485:
note: a parameter list with an ellipsis can't match an empty parameter name list declaration
include/linux/kernel.h:134: error: previous declaration of "printk" was here arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:485:
warning: data definition has no type or storage class arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:490:27:
error: macro "xenoprofile_exit" passed 1 arguments, but takes just 0 arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:491:
error: syntax error before "{" token arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:495:
error: syntax error before "&" token arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:495:
warning: type defaults to "int" in declaration of "xenoprof_arch_unmap_shared_buffer" arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:495:
warning: function declaration isn't a prototype arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:495:
warning: data definition has no type or storage class arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.c:498:
error: syntax error before numeric constant
{standard input}: Assembler messages:
{standard input}:72: Error: symbol `xenoprof_is_primary' is already defined
make[4]: *** [arch/i386/oprofile/../../../drivers/xen/xenoprof/xenoprofile.o] Error 1 make[3]: *** [arch/i386/oprofile] Error 2

#7 lore raw

Re: [Xen-devel] [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

Quoted 26 lines · Jose Renato G
Quoted 17 lines
Quoted 11 lines

QUESTIONS for Isaku:

patch 4/5:
==========

Review

Quoted 4 lines
(quoted diff) +4 -0
+struct xenoprof_shared_buffer {
+	char					*buffer;
+	struct xenoprof_arch_shared_buffer	arch;
+};

The arch field has no extra info for x86. Why do you need this?

On IA64 it is defined as

struct xenoprof_arch_shared_buffer {
        struct resource*        res;
};
Quoted 9 lines

On IA64, auto translated mode feature is enabled. It means that page mapping from xen is based on pseudo physical address, not virtual address. Pseudo physical address used to map pages must be recorded somewhere in order to unmap.
I guess, if xenoprof/x86 supported auto translated guest mode something similar structure would be necessary.

Quoted 5 lines

Isaku

I am still not convinced that we need this. Since this in the kernel
you can always get the pseudo physical address from the virtual address, right? Am I missing something?

Yes, the pseudo physical address itself can be get.
The point is that the pseudo physical addresses aren't always backed by struct page.
In such a case alloc_pages()/free_pages() can't be used, another structure is necessary.
In fact Xen/IA64 allocates the pseudo physical address resion by allocate_resource(&iomem_resource, ...). Not by alloc_pages(). Why doesn't Xen/IA64 use alloc_pages()?
Because it is also used for grant table foreign domain page mapping and its size is very large sometimes. Using alloc_pages() results in OOM. Xen/PPC seems to adopt another approach, though.

Quoted 4 lines

I applied your patches to changeset 12446 but they are failing to
compile. I have attached the make output below

Could you please fix this and resend?

Sorry for that.
It should compile with CONFIG_PROFILING=y and CONFIG_OPORIFLE=y. Anyway I'll fix and resend.

Signature · 1 line
yamahata
#8 lore raw

RE: [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

Quoted 45 lines

-----Original Message-----
From: Isaku Yamahata [mailto:[email protected]]
Sent: Friday, November 17, 2006 6:47 PM
To: Santos, Jose Renato G
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH 1/5 TAKE 2] xenoprof: split xen x86 xenoprof code

Quoted 25 lines · Jose Renato G
Quoted 17 lines
Quoted 11 lines

QUESTIONS for Isaku:

patch 4/5:
==========

Review

Quoted 4 lines
(quoted diff) +4 -0
+struct xenoprof_shared_buffer {
+	char					*buffer;
+	struct xenoprof_arch_shared_buffer	arch;
+};

The arch field has no extra info for x86. Why do you need this?

On IA64 it is defined as

struct xenoprof_arch_shared_buffer {
        struct resource*        res;
};
Quoted 8 lines

On IA64, auto translated mode feature is enabled.
It means that page mapping from xen is based on pseudo physical address, not virtual address. Pseudo physical address used to map pages must be recorded somewhere in order to unmap.
I guess, if xenoprof/x86 supported auto translated guest mode something similar structure would be necessary.

Quoted 3 lines

Isaku

I am still not convinced that we need this. Since this in

the kernel

Quoted 1 line

you can always get the pseudo physical address from the

virtual address,

Quoted 1 line

right? Am I missing something?

Quoted 14 lines

Yes, the pseudo physical address itself can be get.
The point is that the pseudo physical addresses aren't always backed by struct page.
In such a case alloc_pages()/free_pages() can't be used, another structure
is necessary.
In fact Xen/IA64 allocates the pseudo physical address resion by allocate_resource(&iomem_resource, ...). Not by alloc_pages(). Why doesn't Xen/IA64 use alloc_pages()?
Because it is also used for grant table foreign domain page mapping and its size is very large sometimes. Using alloc_pages() results in OOM.
Xen/PPC seems to adopt another approach, though.

OK, I understand now.
You want to keep the mem resource info and the buffer virtual address
in the same struct which you pass to the arch specific code for mapping and unmapping xenoprof pages. I think that is fine.

Regards

Renato

#9 lore raw

PATCH 2/5 xenoprof: make xen xenoprof code slight arch generic

In reply to Isaku Yamahata

# HG changeset patch
# User [email protected]
# Date 1163486060 -32400
# Node ID 0b4114873d25138823956186a87b34f884be6d9a
# Parent 24e1dacab1545640701709be7742608de73063cc replace x86 specific code in xen/common/xenoprof.c
- replace nmi_ prefix with xenoprof_arch_ prefix
- move config_counter to xen/arch/x86/oprofile/xenoprof.c
PATCHNAME: remove_x86_specific_code_from_xen_common_xenoprof_c

xen/arch/x86/oprofile/xenoprof.c +21 -0
diff -r 24e1dacab154 -r 0b4114873d25 xen/arch/x86/oprofile/xenoprof.c
@@ -12,6 +12,27 @@
 #include <xen/sched.h>
 #include <public/xenoprof.h>
 #include <asm/hvm/support.h>
+
+#include "op_counter.h"
+
+int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg)
+{
+    struct xenoprof_counter counter;
+    if ( copy_from_guest(&counter, arg, 1) )
+        return -EFAULT;
+
+    if ( counter.ind > OP_MAX_COUNTER )
+        return -E2BIG;
+
+    counter_config[counter.ind].count     = (unsigned long) counter.count;
+    counter_config[counter.ind].enabled   = (unsigned long) counter.enabled;
+    counter_config[counter.ind].event     = (unsigned long) counter.event;
+    counter_config[counter.ind].kernel    = (unsigned long) counter.kernel;
+    counter_config[counter.ind].user      = (unsigned long) counter.user;
+    counter_config[counter.ind].unit_mask = (unsigned long) counter.unit_mask;
+
+    return 0;
+}
 
 int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs)
 {
xen/common/xenoprof.c +12 -40

116 lines not on this page · raw message

xen/include/asm-x86/xenoprof.h new file +58 -0

58 lines not on this page · raw message

xen/include/xen/xenoprof.h +1 -0
diff -r 24e1dacab154 -r 0b4114873d25 xen/include/xen/xenoprof.h
@@ -11,6 +11,7 @@
 #define __XEN_XENOPROF_H__
 
 #include <public/xenoprof.h>
+#include <asm/xenoprof.h>
 
 #define XENOPROF_DOMAIN_IGNORED    0
 #define XENOPROF_DOMAIN_ACTIVE     1

yamahata

#10 lore raw

PATCH 3/5 xenoprof: split linux x86 xenoprof code

In reply to Isaku Yamahata

# HG changeset patch
# User [email protected]
# Date 1163486061 -32400
# Node ID 384cb18e094aa5baa633598850b1370f6196abae # Parent 0b4114873d25138823956186a87b34f884be6d9a split linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c into linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c without code changes except slight adjustment to compile.
PATCHNAME: split_i386_xenoprof_linux_side

linux-2.6-xen-sparse/arch/i386/oprofile/Makefile +4 -1
diff -r 0b4114873d25 -r 384cb18e094a linux-2.6-xen-sparse/arch/i386/oprofile/Makefile
@@ -7,7 +7,10 @@ DRIVER_OBJS = $(addprefix ../../../drive
 		timer_int.o )
 
 ifdef CONFIG_XEN
-oprofile-y				:= $(DRIVER_OBJS) xenoprof.o
+XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \
+			 xenoprofile.o)
+oprofile-y				:= $(DRIVER_OBJS) \
+					   $(XENOPROF_COMMON_OBJS) xenoprof.o
 else 
 oprofile-y				:= $(DRIVER_OBJS) init.o backtrace.o
 oprofile-$(CONFIG_X86_LOCAL_APIC) 	+= nmi_int.o op_model_athlon.o \
linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +8 -541

565 lines not on this page · raw message

linux-2.6-xen-sparse/arch/x86_64/oprofile/Makefile +4 -1
diff -r 0b4114873d25 -r 384cb18e094a linux-2.6-xen-sparse/arch/x86_64/oprofile/Makefile
@@ -12,6 +12,8 @@ DRIVER_OBJS = $(addprefix ../../../drive
 	timer_int.o )
 
 ifdef CONFIG_XEN
+XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \
+			 xenoprofile.o)
 OPROFILE-y := xenoprof.o
 else
 OPROFILE-y := init.o backtrace.o
@@ -19,4 +21,5 @@ OPROFILE-$(CONFIG_X86_LOCAL_APIC) += nmi
 				     op_model_ppro.o
 OPROFILE-$(CONFIG_X86_IO_APIC)    += nmi_timer_int.o 
 endif
-oprofile-y = $(DRIVER_OBJS) $(addprefix ../../i386/oprofile/, $(OPROFILE-y))
+oprofile-y = $(DRIVER_OBJS) $(XENOPROF_COMMON_OBJS) \
+	     $(addprefix ../../i386/oprofile/, $(OPROFILE-y))
linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c new file +559 -0

559 lines not on this page · raw message

linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h new file +31 -0
diff -r 0b4114873d25 -r 384cb18e094a linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
@@ -0,0 +1,31 @@
+/******************************************************************************
+ * asm-i386/mach-xen/asm/xenoprof.h
+ *
+ * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+#ifndef __ASM_XENOPROF_H__
+#define __ASM_XENOPROF_H__
+#ifdef CONFIG_OPROFILE 
+
+struct super_block;
+struct dentry;
+int xenoprof_create_files(struct super_block * sb, struct dentry * root);
+
+#endif /* CONFIG_OPROFILE */
+#endif /* __ASM_XENOPROF_H__ */
linux-2.6-xen-sparse/include/xen/xenoprof.h new file +30 -0
diff -r 0b4114873d25 -r 384cb18e094a linux-2.6-xen-sparse/include/xen/xenoprof.h
@@ -0,0 +1,30 @@
+/******************************************************************************
+ * xen/xenoprof.h
+ *
+ * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+#ifndef __XEN_XENOPROF_H__
+#define __XEN_XENOPROF_H__
+#ifdef CONFIG_OPROFILE
+
+#include <asm/xenoprof.h>
+
+#endif /* CONFIG_OPROFILE */
+#endif /* __XEN_XENOPROF_H__ */

yamahata

#11 lore raw

PATCH 4/5 xenoprof: make linux xenoprof code arch-generic

In reply to Isaku Yamahata

# HG changeset patch
# User [email protected]
# Date 1163486062 -32400
# Node ID 3bebc37b149280f5ff1e6091d578c7da73820f16 # Parent 384cb18e094aa5baa633598850b1370f6196abae make xenoprof of linux side arch generic with some bug fixes.
PATCHNAME: make_xenoprof_of_linux_side_arch_generic

linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +129 -1
diff -r 384cb18e094a -r 3bebc37b1492 linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
@@ -15,12 +15,130 @@
  *                    VA Linux Systems Japan K.K.
  */
 
+#include <linux/init.h>
 #include <linux/oprofile.h>
+#include <linux/sched.h>
+#include <asm/pgtable.h>
 
+#include <xen/driver_util.h>
+#include <xen/interface/xen.h>
+#include <xen/interface/xenoprof.h>
 #include <xen/xenoprof.h>
 #include "op_counter.h"
 
-unsigned int num_events = 0;
+static unsigned int num_events = 0;
+
+void __init xenoprof_arch_init_counter(struct xenoprof_init *init)
+{
+	num_events = init->num_events;
+	/* just in case - make sure we do not overflow event list 
+	   (i.e. counter_config list) */
+	if (num_events > OP_MAX_COUNTER) {
+		num_events = OP_MAX_COUNTER;
+		init->num_events = num_events;
+	}
+}
+
+void xenoprof_arch_counter(void)
+{
+	int i;
+	struct xenoprof_counter counter;
+
+	for (i=0; i<num_events; i++) {
+		counter.ind       = i;
+		counter.count     = (uint64_t)counter_config[i].count;
+		counter.enabled   = (uint32_t)counter_config[i].enabled;
+		counter.event     = (uint32_t)counter_config[i].event;
+		counter.kernel    = (uint32_t)counter_config[i].kernel;
+		counter.user      = (uint32_t)counter_config[i].user;
+		counter.unit_mask = (uint64_t)counter_config[i].unit_mask;
+		HYPERVISOR_xenoprof_op(XENOPROF_counter, 
+				       &counter);
+	}
+}
+
+void xenoprof_arch_start(void) 
+{
+	/* nothing */
+}
+
+void xenoprof_arch_stop(void)
+{
+	/* nothing */
+}
+
+void xenoprof_arch_unmap_shared_buffer(struct xenoprof_shared_buffer * sbuf)
+{
+	if (sbuf->buffer) {
+		vunmap(sbuf->buffer);
+		sbuf->buffer = NULL;
+	}
+}
+
+int xenoprof_arch_map_shared_buffer(struct xenoprof_get_buffer * get_buffer,
+				    struct xenoprof_shared_buffer * sbuf)
+{
+	int npages, ret;
+	struct vm_struct *area;
+
+	sbuf->buffer = NULL;
+	if ( (ret = HYPERVISOR_xenoprof_op(XENOPROF_get_buffer, get_buffer)) )
+		return ret;
+
+	npages = (get_buffer->bufsize * get_buffer->nbuf - 1) / PAGE_SIZE + 1;
+
+	area = alloc_vm_area(npages * PAGE_SIZE);
+	if (area == NULL)
+		return -ENOMEM;
+
+	if ( (ret = direct_kernel_remap_pfn_range(
+		      (unsigned long)area->addr,
+		      get_buffer->buf_maddr >> PAGE_SHIFT,
+		      npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE),
+		      DOMID_SELF)) ) {
+		vunmap(area->addr);
+		return ret;
+	}
+
+	sbuf->buffer = area->addr;
+	return ret;
+}
+
+int xenoprof_arch_set_passive(struct xenoprof_passive * pdomain,
+			      struct xenoprof_shared_buffer * sbuf)
+{
+	int ret;
+	int npages;
+	struct vm_struct *area;
+	pgprot_t prot = __pgprot(_KERNPG_TABLE);
+
+	sbuf->buffer = NULL;
+	ret = HYPERVISOR_xenoprof_op(XENOPROF_set_passive, pdomain);
+	if (ret)
+		goto out;
+
+	npages = (pdomain->bufsize * pdomain->nbuf - 1) / PAGE_SIZE + 1;
+
+	area = alloc_vm_area(npages * PAGE_SIZE);
+	if (area == NULL) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	ret = direct_kernel_remap_pfn_range(
+		(unsigned long)area->addr,
+		pdomain->buf_maddr >> PAGE_SHIFT,
+		npages * PAGE_SIZE, prot, DOMID_SELF);
+	if (ret) {
+		vunmap(area->addr);
+		goto out;
+	}
+	sbuf->buffer = area->addr;
+
+out:
+	return ret;
+}
+
 struct op_counter_config counter_config[OP_MAX_COUNTER];
 
 int xenoprof_create_files(struct super_block * sb, struct dentry * root)
@@ -49,3 +167,13 @@ int xenoprof_create_files(struct super_b
 
 	return 0;
 }
+
+int __init oprofile_arch_init(struct oprofile_operations * ops)
+{
+	return xenoprofile_init(ops);
+}
+
+void __exit oprofile_arch_exit(void)
+{
+	xenoprofile_exit();
+}
linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c +68 -127

374 lines not on this page · raw message

linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h +18 -1
diff -r 384cb18e094a -r 3bebc37b1492 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
@@ -21,11 +21,28 @@
  */
 #ifndef __ASM_XENOPROF_H__
 #define __ASM_XENOPROF_H__
-#ifdef CONFIG_OPROFILE 
+#ifdef CONFIG_OPROFILE
 
 struct super_block;
 struct dentry;
 int xenoprof_create_files(struct super_block * sb, struct dentry * root);
+#define HAVE_XENOPROF_CREATE_FILES
+
+struct xenoprof_init;
+void xenoprof_arch_init_counter(struct xenoprof_init *init);
+void xenoprof_arch_counter(void);
+void xenoprof_arch_start(void);
+void xenoprof_arch_stop(void);
+
+struct xenoprof_arch_shared_buffer {
+	/* nothing */
+};
+struct xenoprof_shared_buffer;
+void xenoprof_arch_unmap_shared_buffer(struct xenoprof_shared_buffer* sbuf);
+struct xenoprof_get_buffer;
+int xenoprof_arch_map_shared_buffer(struct xenoprof_get_buffer* get_buffer, struct xenoprof_shared_buffer* sbuf);
+struct xenoprof_passive;
+int xenoprof_arch_set_passive(struct xenoprof_passive* pdomain, struct xenoprof_shared_buffer* sbuf);
 
 #endif /* CONFIG_OPROFILE */
 #endif /* __ASM_XENOPROF_H__ */
linux-2.6-xen-sparse/include/xen/xenoprof.h +17 -1
diff -r 384cb18e094a -r 3bebc37b1492 linux-2.6-xen-sparse/include/xen/xenoprof.h
@@ -22,9 +22,25 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__
+
 #ifdef CONFIG_OPROFILE
-
 #include <asm/xenoprof.h>
 
+struct oprofile_operations;
+int xenoprofile_init(struct oprofile_operations * ops);
+void xenoprofile_exit(void);
+
+// for perfmon/xen
+extern int xenoprof_is_primary;
+#define is_xenoprof_primary()	(xenoprof_is_primary)
+struct xenoprof_shared_buffer {
+	char					*buffer;
+	struct xenoprof_arch_shared_buffer	arch;
+};
+#else
+#define xenoprofile_init(ops)	do { } while (0)
+#define xenoprofile_exit()	do { } while (0)
+#define is_xenoprof_primary()	(0)
 #endif /* CONFIG_OPROFILE */
+
 #endif /* __XEN_XENOPROF_H__ */

yamahata

#12 lore raw

Re: [PATCH 4/5 TAKE 2] xenoprof: make linux xenoprof code arch-generic

Updated following Renato's comments.

Changes:
- __exit clean up
- removed perfmon comments

# HG changeset patch
# User [email protected]
# Date 1163486062 -32400
# Node ID 9bf71c7abb2de71ac233c24d821978ce2e6cc961 # Parent e9e5f10f89615f88d433a670a69a2ba4af60c791 make xenoprof of linux side arch generic with some bug fixes.
PATCHNAME: make_xenoprof_of_linux_side_arch_generic

linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +129 -1
diff -r e9e5f10f8961 -r 9bf71c7abb2d linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
@@ -15,12 +15,130 @@
  *                    VA Linux Systems Japan K.K.
  */
 
+#include <linux/init.h>
 #include <linux/oprofile.h>
+#include <linux/sched.h>
+#include <asm/pgtable.h>
 
+#include <xen/driver_util.h>
+#include <xen/interface/xen.h>
+#include <xen/interface/xenoprof.h>
 #include <xen/xenoprof.h>
 #include "op_counter.h"
 
-unsigned int num_events = 0;
+static unsigned int num_events = 0;
+
+void __init xenoprof_arch_init_counter(struct xenoprof_init *init)
+{
+	num_events = init->num_events;
+	/* just in case - make sure we do not overflow event list 
+	   (i.e. counter_config list) */
+	if (num_events > OP_MAX_COUNTER) {
+		num_events = OP_MAX_COUNTER;
+		init->num_events = num_events;
+	}
+}
+
+void xenoprof_arch_counter(void)
+{
+	int i;
+	struct xenoprof_counter counter;
+
+	for (i=0; i<num_events; i++) {
+		counter.ind       = i;
+		counter.count     = (uint64_t)counter_config[i].count;
+		counter.enabled   = (uint32_t)counter_config[i].enabled;
+		counter.event     = (uint32_t)counter_config[i].event;
+		counter.kernel    = (uint32_t)counter_config[i].kernel;
+		counter.user      = (uint32_t)counter_config[i].user;
+		counter.unit_mask = (uint64_t)counter_config[i].unit_mask;
+		HYPERVISOR_xenoprof_op(XENOPROF_counter, 
+				       &counter);
+	}
+}
+
+void xenoprof_arch_start(void) 
+{
+	/* nothing */
+}
+
+void xenoprof_arch_stop(void)
+{
+	/* nothing */
+}
+
+void xenoprof_arch_unmap_shared_buffer(struct xenoprof_shared_buffer * sbuf)
+{
+	if (sbuf->buffer) {
+		vunmap(sbuf->buffer);
+		sbuf->buffer = NULL;
+	}
+}
+
+int xenoprof_arch_map_shared_buffer(struct xenoprof_get_buffer * get_buffer,
+				    struct xenoprof_shared_buffer * sbuf)
+{
+	int npages, ret;
+	struct vm_struct *area;
+
+	sbuf->buffer = NULL;
+	if ( (ret = HYPERVISOR_xenoprof_op(XENOPROF_get_buffer, get_buffer)) )
+		return ret;
+
+	npages = (get_buffer->bufsize * get_buffer->nbuf - 1) / PAGE_SIZE + 1;
+
+	area = alloc_vm_area(npages * PAGE_SIZE);
+	if (area == NULL)
+		return -ENOMEM;
+
+	if ( (ret = direct_kernel_remap_pfn_range(
+		      (unsigned long)area->addr,
+		      get_buffer->buf_maddr >> PAGE_SHIFT,
+		      npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE),
+		      DOMID_SELF)) ) {
+		vunmap(area->addr);
+		return ret;
+	}
+
+	sbuf->buffer = area->addr;
+	return ret;
+}
+
+int xenoprof_arch_set_passive(struct xenoprof_passive * pdomain,
+			      struct xenoprof_shared_buffer * sbuf)
+{
+	int ret;
+	int npages;
+	struct vm_struct *area;
+	pgprot_t prot = __pgprot(_KERNPG_TABLE);
+
+	sbuf->buffer = NULL;
+	ret = HYPERVISOR_xenoprof_op(XENOPROF_set_passive, pdomain);
+	if (ret)
+		goto out;
+
+	npages = (pdomain->bufsize * pdomain->nbuf - 1) / PAGE_SIZE + 1;
+
+	area = alloc_vm_area(npages * PAGE_SIZE);
+	if (area == NULL) {
+		ret = -ENOMEM;
+		goto out;
+	}
+
+	ret = direct_kernel_remap_pfn_range(
+		(unsigned long)area->addr,
+		pdomain->buf_maddr >> PAGE_SHIFT,
+		npages * PAGE_SIZE, prot, DOMID_SELF);
+	if (ret) {
+		vunmap(area->addr);
+		goto out;
+	}
+	sbuf->buffer = area->addr;
+
+out:
+	return ret;
+}
+
 struct op_counter_config counter_config[OP_MAX_COUNTER];
 
 int xenoprof_create_files(struct super_block * sb, struct dentry * root)
@@ -49,3 +167,13 @@ int xenoprof_create_files(struct super_b
 
 	return 0;
 }
+
+int __init oprofile_arch_init(struct oprofile_operations * ops)
+{
+	return xenoprofile_init(ops);
+}
+
+void oprofile_arch_exit(void)
+{
+	xenoprofile_exit();
+}
linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c +68 -127

374 lines not on this page · raw message

linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h +18 -1
diff -r e9e5f10f8961 -r 9bf71c7abb2d linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
@@ -21,11 +21,28 @@
  */
 #ifndef __ASM_XENOPROF_H__
 #define __ASM_XENOPROF_H__
-#ifdef CONFIG_OPROFILE 
+#ifdef CONFIG_OPROFILE
 
 struct super_block;
 struct dentry;
 int xenoprof_create_files(struct super_block * sb, struct dentry * root);
+#define HAVE_XENOPROF_CREATE_FILES
+
+struct xenoprof_init;
+void xenoprof_arch_init_counter(struct xenoprof_init *init);
+void xenoprof_arch_counter(void);
+void xenoprof_arch_start(void);
+void xenoprof_arch_stop(void);
+
+struct xenoprof_arch_shared_buffer {
+	/* nothing */
+};
+struct xenoprof_shared_buffer;
+void xenoprof_arch_unmap_shared_buffer(struct xenoprof_shared_buffer* sbuf);
+struct xenoprof_get_buffer;
+int xenoprof_arch_map_shared_buffer(struct xenoprof_get_buffer* get_buffer, struct xenoprof_shared_buffer* sbuf);
+struct xenoprof_passive;
+int xenoprof_arch_set_passive(struct xenoprof_passive* pdomain, struct xenoprof_shared_buffer* sbuf);
 
 #endif /* CONFIG_OPROFILE */
 #endif /* __ASM_XENOPROF_H__ */
linux-2.6-xen-sparse/include/xen/xenoprof.h +16 -1
diff -r e9e5f10f8961 -r 9bf71c7abb2d linux-2.6-xen-sparse/include/xen/xenoprof.h
@@ -22,9 +22,24 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__
+
 #ifdef CONFIG_OPROFILE
-
 #include <asm/xenoprof.h>
 
+struct oprofile_operations;
+int xenoprofile_init(struct oprofile_operations * ops);
+void xenoprofile_exit(void);
+
+extern int xenoprof_is_primary;
+#define is_xenoprof_primary()	(xenoprof_is_primary)
+struct xenoprof_shared_buffer {
+	char					*buffer;
+	struct xenoprof_arch_shared_buffer	arch;
+};
+#else
+#define xenoprofile_init(ops)	do { } while (0)
+#define xenoprofile_exit()	do { } while (0)
+#define is_xenoprof_primary()	(0)
 #endif /* CONFIG_OPROFILE */
+
 #endif /* __XEN_XENOPROF_H__ */
Signature · 1 line
yamahata

# HG changeset patch
# User [email protected]
# Date 1163486062 -32400
# Node ID 9bf71c7abb2de71ac233c24d821978ce2e6cc961 # Parent e9e5f10f89615f88d433a670a69a2ba4af60c791 make xenoprof of linux side arch generic with some bug fixes.
PATCHNAME: make_xenoprof_of_linux_side_arch_generic

linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +129 -1

144 lines not on this page · raw message

linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c +68 -127

374 lines not on this page · raw message

linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h +18 -1
diff -r e9e5f10f8961 -r 9bf71c7abb2d linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
@@ -21,11 +21,28 @@
  */
 #ifndef __ASM_XENOPROF_H__
 #define __ASM_XENOPROF_H__
-#ifdef CONFIG_OPROFILE 
+#ifdef CONFIG_OPROFILE
 
 struct super_block;
 struct dentry;
 int xenoprof_create_files(struct super_block * sb, struct dentry * root);
+#define HAVE_XENOPROF_CREATE_FILES
+
+struct xenoprof_init;
+void xenoprof_arch_init_counter(struct xenoprof_init *init);
+void xenoprof_arch_counter(void);
+void xenoprof_arch_start(void);
+void xenoprof_arch_stop(void);
+
+struct xenoprof_arch_shared_buffer {
+	/* nothing */
+};
+struct xenoprof_shared_buffer;
+void xenoprof_arch_unmap_shared_buffer(struct xenoprof_shared_buffer* sbuf);
+struct xenoprof_get_buffer;
+int xenoprof_arch_map_shared_buffer(struct xenoprof_get_buffer* get_buffer, struct xenoprof_shared_buffer* sbuf);
+struct xenoprof_passive;
+int xenoprof_arch_set_passive(struct xenoprof_passive* pdomain, struct xenoprof_shared_buffer* sbuf);
 
 #endif /* CONFIG_OPROFILE */
 #endif /* __ASM_XENOPROF_H__ */
linux-2.6-xen-sparse/include/xen/xenoprof.h +16 -1
diff -r e9e5f10f8961 -r 9bf71c7abb2d linux-2.6-xen-sparse/include/xen/xenoprof.h
@@ -22,9 +22,24 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__
+
 #ifdef CONFIG_OPROFILE
-
 #include <asm/xenoprof.h>
 
+struct oprofile_operations;
+int xenoprofile_init(struct oprofile_operations * ops);
+void xenoprofile_exit(void);
+
+extern int xenoprof_is_primary;
+#define is_xenoprof_primary()	(xenoprof_is_primary)
+struct xenoprof_shared_buffer {
+	char					*buffer;
+	struct xenoprof_arch_shared_buffer	arch;
+};
+#else
+#define xenoprofile_init(ops)	do { } while (0)
+#define xenoprofile_exit()	do { } while (0)
+#define is_xenoprof_primary()	(0)
 #endif /* CONFIG_OPROFILE */
+
 #endif /* __XEN_XENOPROF_H__ */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#13 lore raw

Re: [Xen-devel] [PATCH 4/5 TAKE 2] xenoprof: make linux xenoprof code arch-generic

make xenoprof of linux side arch generic with some bug fixes.

Changes:
- support modular oprofile
- move xenoprof_is_primary from xenoprofile.c.
It is referenced by perfmon which isn't module even when xenoprof is module.

# HG changeset patch
# User [email protected]
# Date 1163822321 -32400
# Node ID 5bc23b56ed059dbee77d63d191ad355f7135f9be # Parent 70b1700b6c5ad28ec24a1cb37f4a3afc44347bad make xenoprof of linux side arch generic with some bug fixes.
PATCHNAME: make_xenoprof_of_linux_side_arch_generic

linux-2.6-xen-sparse/arch/i386/oprofile/Makefile +1 -1
diff -r 70b1700b6c5a -r 5bc23b56ed05 linux-2.6-xen-sparse/arch/i386/oprofile/Makefile
@@ -8,7 +8,7 @@ DRIVER_OBJS = $(addprefix ../../../drive
 
 ifdef CONFIG_XEN
 XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \
-			 xenoprofile.o)
+			 xenoprofile.o xenoprof_is_primary.o)
 oprofile-y				:= $(DRIVER_OBJS) \
 					   $(XENOPROF_COMMON_OBJS) xenoprof.o
 else 
linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +129 -1

144 lines not on this page · raw message

linux-2.6-xen-sparse/arch/x86_64/oprofile/Makefile +1 -1
diff -r 70b1700b6c5a -r 5bc23b56ed05 linux-2.6-xen-sparse/arch/x86_64/oprofile/Makefile
@@ -13,7 +13,7 @@ DRIVER_OBJS = $(addprefix ../../../drive
 
 ifdef CONFIG_XEN
 XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \
-			 xenoprofile.o)
+			 xenoprofile.o xenoprof_is_primary.o)
 OPROFILE-y := xenoprof.o
 else
 OPROFILE-y := init.o backtrace.o
linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprof_is_primary.c new file +22 -0
diff -r 70b1700b6c5a -r 5bc23b56ed05 linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprof_is_primary.c
@@ -0,0 +1,22 @@
+/**
+ * @file xenoprof_is_primary.c
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author John Levon <[email protected]>
+ *
+ * Modified by Aravind Menon and Jose Renato Santos for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
+ *
+ * Separated out arch-generic part
+ * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+
+int xenoprof_is_primary = 0;
+EXPORT_SYMBOL_GPL(xenoprof_is_primary);
linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c +68 -128

374 lines not on this page · raw message

linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h +19 -2
diff -r 70b1700b6c5a -r 5bc23b56ed05 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
@@ -21,11 +21,28 @@
  */
 #ifndef __ASM_XENOPROF_H__
 #define __ASM_XENOPROF_H__
-#ifdef CONFIG_OPROFILE 
+#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
 
 struct super_block;
 struct dentry;
 int xenoprof_create_files(struct super_block * sb, struct dentry * root);
+#define HAVE_XENOPROF_CREATE_FILES
 
-#endif /* CONFIG_OPROFILE */
+struct xenoprof_init;
+void xenoprof_arch_init_counter(struct xenoprof_init *init);
+void xenoprof_arch_counter(void);
+void xenoprof_arch_start(void);
+void xenoprof_arch_stop(void);
+
+struct xenoprof_arch_shared_buffer {
+	/* nothing */
+};
+struct xenoprof_shared_buffer;
+void xenoprof_arch_unmap_shared_buffer(struct xenoprof_shared_buffer* sbuf);
+struct xenoprof_get_buffer;
+int xenoprof_arch_map_shared_buffer(struct xenoprof_get_buffer* get_buffer, struct xenoprof_shared_buffer* sbuf);
+struct xenoprof_passive;
+int xenoprof_arch_set_passive(struct xenoprof_passive* pdomain, struct xenoprof_shared_buffer* sbuf);
+
+#endif /* CONFIG_OPROFILE || CONFIG_OPROFILE_MODULE */
 #endif /* __ASM_XENOPROF_H__ */
linux-2.6-xen-sparse/include/xen/xenoprof.h +17 -2
diff -r 70b1700b6c5a -r 5bc23b56ed05 linux-2.6-xen-sparse/include/xen/xenoprof.h
@@ -22,9 +22,24 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__
-#ifdef CONFIG_OPROFILE
 
+#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
 #include <asm/xenoprof.h>
 
-#endif /* CONFIG_OPROFILE */
+struct oprofile_operations;
+int xenoprofile_init(struct oprofile_operations * ops);
+void xenoprofile_exit(void);
+
+extern int xenoprof_is_primary;
+#define is_xenoprof_primary()	(xenoprof_is_primary)
+struct xenoprof_shared_buffer {
+	char					*buffer;
+	struct xenoprof_arch_shared_buffer	arch;
+};
+#else
+#define xenoprofile_init(ops)	do { } while (0)
+#define xenoprofile_exit()	do { } while (0)
+#define is_xenoprof_primary()	(0)
+#endif /* CONFIG_OPROFILE || CONFIG_OPORFILE_MODULE */
+
 #endif /* __XEN_XENOPROF_H__ */
Signature · 1 line
yamahata

# HG changeset patch
# User [email protected]
# Date 1163822321 -32400
# Node ID 5bc23b56ed059dbee77d63d191ad355f7135f9be # Parent 70b1700b6c5ad28ec24a1cb37f4a3afc44347bad make xenoprof of linux side arch generic with some bug fixes.
PATCHNAME: make_xenoprof_of_linux_side_arch_generic

linux-2.6-xen-sparse/arch/i386/oprofile/Makefile +1 -1
diff -r 70b1700b6c5a -r 5bc23b56ed05 linux-2.6-xen-sparse/arch/i386/oprofile/Makefile
@@ -8,7 +8,7 @@ DRIVER_OBJS = $(addprefix ../../../drive
 
 ifdef CONFIG_XEN
 XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \
-			 xenoprofile.o)
+			 xenoprofile.o xenoprof_is_primary.o)
 oprofile-y				:= $(DRIVER_OBJS) \
 					   $(XENOPROF_COMMON_OBJS) xenoprof.o
 else 
linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +129 -1

144 lines not on this page · raw message

linux-2.6-xen-sparse/arch/x86_64/oprofile/Makefile +1 -1
diff -r 70b1700b6c5a -r 5bc23b56ed05 linux-2.6-xen-sparse/arch/x86_64/oprofile/Makefile
@@ -13,7 +13,7 @@ DRIVER_OBJS = $(addprefix ../../../drive
 
 ifdef CONFIG_XEN
 XENOPROF_COMMON_OBJS = $(addprefix ../../../drivers/xen/xenoprof/, \
-			 xenoprofile.o)
+			 xenoprofile.o xenoprof_is_primary.o)
 OPROFILE-y := xenoprof.o
 else
 OPROFILE-y := init.o backtrace.o
linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprof_is_primary.c new file +22 -0
diff -r 70b1700b6c5a -r 5bc23b56ed05 linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprof_is_primary.c
@@ -0,0 +1,22 @@
+/**
+ * @file xenoprof_is_primary.c
+ *
+ * @remark Copyright 2002 OProfile authors
+ * @remark Read the file COPYING
+ *
+ * @author John Levon <[email protected]>
+ *
+ * Modified by Aravind Menon and Jose Renato Santos for Xen
+ * These modifications are:
+ * Copyright (C) 2005 Hewlett-Packard Co.
+ *
+ * Separated out arch-generic part
+ * Copyright (c) 2006 Isaku Yamahata <yamahata at valinux co jp>
+ *                    VA Linux Systems Japan K.K.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+
+int xenoprof_is_primary = 0;
+EXPORT_SYMBOL_GPL(xenoprof_is_primary);
linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c +68 -128

374 lines not on this page · raw message

linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h +19 -2
diff -r 70b1700b6c5a -r 5bc23b56ed05 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
@@ -21,11 +21,28 @@
  */
 #ifndef __ASM_XENOPROF_H__
 #define __ASM_XENOPROF_H__
-#ifdef CONFIG_OPROFILE 
+#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
 
 struct super_block;
 struct dentry;
 int xenoprof_create_files(struct super_block * sb, struct dentry * root);
+#define HAVE_XENOPROF_CREATE_FILES
 
-#endif /* CONFIG_OPROFILE */
+struct xenoprof_init;
+void xenoprof_arch_init_counter(struct xenoprof_init *init);
+void xenoprof_arch_counter(void);
+void xenoprof_arch_start(void);
+void xenoprof_arch_stop(void);
+
+struct xenoprof_arch_shared_buffer {
+	/* nothing */
+};
+struct xenoprof_shared_buffer;
+void xenoprof_arch_unmap_shared_buffer(struct xenoprof_shared_buffer* sbuf);
+struct xenoprof_get_buffer;
+int xenoprof_arch_map_shared_buffer(struct xenoprof_get_buffer* get_buffer, struct xenoprof_shared_buffer* sbuf);
+struct xenoprof_passive;
+int xenoprof_arch_set_passive(struct xenoprof_passive* pdomain, struct xenoprof_shared_buffer* sbuf);
+
+#endif /* CONFIG_OPROFILE || CONFIG_OPROFILE_MODULE */
 #endif /* __ASM_XENOPROF_H__ */
linux-2.6-xen-sparse/include/xen/xenoprof.h +17 -2
diff -r 70b1700b6c5a -r 5bc23b56ed05 linux-2.6-xen-sparse/include/xen/xenoprof.h
@@ -22,9 +22,24 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__
-#ifdef CONFIG_OPROFILE
 
+#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
 #include <asm/xenoprof.h>
 
-#endif /* CONFIG_OPROFILE */
+struct oprofile_operations;
+int xenoprofile_init(struct oprofile_operations * ops);
+void xenoprofile_exit(void);
+
+extern int xenoprof_is_primary;
+#define is_xenoprof_primary()	(xenoprof_is_primary)
+struct xenoprof_shared_buffer {
+	char					*buffer;
+	struct xenoprof_arch_shared_buffer	arch;
+};
+#else
+#define xenoprofile_init(ops)	do { } while (0)
+#define xenoprofile_exit()	do { } while (0)
+#define is_xenoprof_primary()	(0)
+#endif /* CONFIG_OPROFILE || CONFIG_OPORFILE_MODULE */
+
 #endif /* __XEN_XENOPROF_H__ */

_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel

#14 lore raw

RE: [PATCH 4/5 TAKE 2] xenoprof: make linux xenoprof codearch-generic

Quoted 13 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Isaku Yamahata
Sent: Friday, November 17, 2006 8:22 PM
To: [email protected]
Cc: [email protected]
Subject: Re: [Xen-devel] [PATCH 4/5 TAKE 2] xenoprof: make linux xenoprof codearch-generic

Quoted 8 lines

make xenoprof of linux side arch generic with some bug fixes.

Changes:
- support modular oprofile
- move xenoprof_is_primary from xenoprofile.c.
It is referenced by perfmon which isn't module even when xenoprof is module.

Why perfmon needs to access Oprofile? It should be the other way
around ...
It seems that the only change was to create a new file named
xenoprof_is_primary.c to hold the definition of xenoprof_is_primary
I don't like this. And I don't understand why you need this. You
should deal with IA64 specifics in arch specific code as much as possible. Could you please find an IA64 specific solution or explain why this is needed in the generic part?

Also, if sending another patch please send me only the changes from
the initial 5 patches you sent me. I would like to see only the changes
...
(do not use this last patch as reference, I am ignoring it) Thanks

Renato

#15 lore raw

Re: [PATCH 4/5 TAKE 2] xenoprof: make linux xenoprof codearch-generic

Quoted 8 lines · Jose Renato G

Why perfmon needs to access Oprofile? It should be the other way
around ...
It seems that the only change was to create a new file named
xenoprof_is_primary.c to hold the definition of xenoprof_is_primary
I don't like this. And I don't understand why you need this. You
should deal with IA64 specifics in arch specific code as much as possible. Could you please find an IA64 specific solution or explain why this is needed in the generic part?

I found the way without referencing it so that I made it static.

Quoted 4 lines

Also, if sending another patch please send me only the changes from
the initial 5 patches you sent me. I would like to see only the changes
...
(do not use this last patch as reference, I am ignoring it)

Here is the patch to follow
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00842.html.

To make sure, I also attached the patch for PATCH 4/5 TAKE2
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg00689.html

thanks,

# HG changeset patch
# User [email protected]
# Date 1164087772 -32400
# Node ID ab6c1b607484d3b273d091a11334a3458d36349c # Parent e8fba03edf517b88a91aee47afbc15ab89e5d434 update xenoprof linux side patch following Renato's comment.
- compilation fix when CONFIG_OPROFILE=m with minor clean up
- don't export xenoprof_is_primary.
PATCHNAME: xenoprof_linux_side_update

linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c +1 -1
diff -r e8fba03edf51 -r ab6c1b607484 linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c
@@ -48,7 +48,7 @@ static void xenoprof_stop(void);
 static void xenoprof_stop(void);
 
 static int xenoprof_enabled = 0;
-int xenoprof_is_primary = 0;
+static int xenoprof_is_primary = 0;
 static int active_defined;
 
 /* Number of buffers in shared area (one per VCPU) */
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h +2 -2
diff -r e8fba03edf51 -r ab6c1b607484 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
@@ -21,7 +21,7 @@
  */
 #ifndef __ASM_XENOPROF_H__
 #define __ASM_XENOPROF_H__
-#ifdef CONFIG_OPROFILE
+#ifdef CONFIG_XEN
 
 struct super_block;
 struct dentry;
@@ -44,5 +44,5 @@ struct xenoprof_passive;
 struct xenoprof_passive;
 int xenoprof_arch_set_passive(struct xenoprof_passive* pdomain, struct xenoprof_shared_buffer* sbuf);
 
-#endif /* CONFIG_OPROFILE */
+#endif /* CONFIG_XEN */
 #endif /* __ASM_XENOPROF_H__ */
linux-2.6-xen-sparse/include/xen/xenoprof.h +3 -6
diff -r e8fba03edf51 -r ab6c1b607484 linux-2.6-xen-sparse/include/xen/xenoprof.h
@@ -22,24 +22,21 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__
+#ifdef CONFIG_XEN
 
-#ifdef CONFIG_OPROFILE
 #include <asm/xenoprof.h>
 
 struct oprofile_operations;
 int xenoprofile_init(struct oprofile_operations * ops);
 void xenoprofile_exit(void);
 
-extern int xenoprof_is_primary;
-#define is_xenoprof_primary()	(xenoprof_is_primary)
 struct xenoprof_shared_buffer {
 	char					*buffer;
 	struct xenoprof_arch_shared_buffer	arch;
 };
 #else
-#define xenoprofile_init(ops)	do { } while (0)
+#define xenoprofile_init(ops)	(-ENOSYS)
 #define xenoprofile_exit()	do { } while (0)
-#define is_xenoprof_primary()	(0)
-#endif /* CONFIG_OPROFILE */
 
+#endif /* CONFIG_XEN */
 #endif /* __XEN_XENOPROF_H__ */
Signature · 1 line
yamahata

# HG changeset patch
# User [email protected]
# Date 1164087772 -32400
# Node ID ab6c1b607484d3b273d091a11334a3458d36349c # Parent e8fba03edf517b88a91aee47afbc15ab89e5d434 update xenoprof linux side patch following Renato's comment.
- compilation fix when CONFIG_OPROFILE=m with minor clean up
- don't export xenoprof_is_primary.
PATCHNAME: xenoprof_linux_side_update

linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c +1 -1
diff -r e8fba03edf51 -r ab6c1b607484 linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c
@@ -48,7 +48,7 @@ static void xenoprof_stop(void);
 static void xenoprof_stop(void);
 
 static int xenoprof_enabled = 0;
-int xenoprof_is_primary = 0;
+static int xenoprof_is_primary = 0;
 static int active_defined;
 
 /* Number of buffers in shared area (one per VCPU) */
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h +2 -2
diff -r e8fba03edf51 -r ab6c1b607484 linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
@@ -21,7 +21,7 @@
  */
 #ifndef __ASM_XENOPROF_H__
 #define __ASM_XENOPROF_H__
-#ifdef CONFIG_OPROFILE
+#ifdef CONFIG_XEN
 
 struct super_block;
 struct dentry;
@@ -44,5 +44,5 @@ struct xenoprof_passive;
 struct xenoprof_passive;
 int xenoprof_arch_set_passive(struct xenoprof_passive* pdomain, struct xenoprof_shared_buffer* sbuf);
 
-#endif /* CONFIG_OPROFILE */
+#endif /* CONFIG_XEN */
 #endif /* __ASM_XENOPROF_H__ */
linux-2.6-xen-sparse/include/xen/xenoprof.h +3 -6
diff -r e8fba03edf51 -r ab6c1b607484 linux-2.6-xen-sparse/include/xen/xenoprof.h
@@ -22,24 +22,21 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__
+#ifdef CONFIG_XEN
 
-#ifdef CONFIG_OPROFILE
 #include <asm/xenoprof.h>
 
 struct oprofile_operations;
 int xenoprofile_init(struct oprofile_operations * ops);
 void xenoprofile_exit(void);
 
-extern int xenoprof_is_primary;
-#define is_xenoprof_primary()	(xenoprof_is_primary)
 struct xenoprof_shared_buffer {
 	char					*buffer;
 	struct xenoprof_arch_shared_buffer	arch;
 };
 #else
-#define xenoprofile_init(ops)	do { } while (0)
+#define xenoprofile_init(ops)	(-ENOSYS)
 #define xenoprofile_exit()	do { } while (0)
-#define is_xenoprof_primary()	(0)
-#endif /* CONFIG_OPROFILE */
 
+#endif /* CONFIG_XEN */
 #endif /* __XEN_XENOPROF_H__ */

# HG changeset patch
# User [email protected]
# Date 1164087487 -32400
# Node ID 7e4eac672ace7bdd7fd0b6dc4da97d3e329bd3b2 # Parent 7043f58fc99326a9c0a9f737681c0226239844cc update xenoprof linux side patch following Renato's comment.
- __exit clean up
- remove perfmon comments
- compilation fix when CONFIG_OPROFILE=m with minor clean up
- don't export xenoprof_is_primary.
PATCHNAME: xenoprof_linux_side_update

linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +1 -1
diff -r 7043f58fc993 -r 7e4eac672ace linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
@@ -173,7 +173,7 @@ int __init oprofile_arch_init(struct opr
 	return xenoprofile_init(ops);
 }
 
-void __exit oprofile_arch_exit(void)
+void oprofile_arch_exit(void)
 {
 	xenoprofile_exit();
 }
linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c +2 -2
diff -r 7043f58fc993 -r 7e4eac672ace linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c
@@ -48,7 +48,7 @@ static void xenoprof_stop(void);
 static void xenoprof_stop(void);
 
 static int xenoprof_enabled = 0;
-int xenoprof_is_primary = 0;
+static int xenoprof_is_primary = 0;
 static int active_defined;
 
 /* Number of buffers in shared area (one per VCPU) */
@@ -98,7 +98,7 @@ static int __init init_driverfs(void)
 }
 
 
-static void /* __exit */ exit_driverfs(void)
+static void exit_driverfs(void)
 {
 	sysdev_unregister(&device_oprofile);
 	sysdev_class_unregister(&oprofile_sysclass);
linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h +2 -2
diff -r 7043f58fc993 -r 7e4eac672ace linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
@@ -21,7 +21,7 @@
  */
 #ifndef __ASM_XENOPROF_H__
 #define __ASM_XENOPROF_H__
-#ifdef CONFIG_OPROFILE
+#ifdef CONFIG_XEN
 
 struct super_block;
 struct dentry;
@@ -44,5 +44,5 @@ struct xenoprof_passive;
 struct xenoprof_passive;
 int xenoprof_arch_set_passive(struct xenoprof_passive* pdomain, struct xenoprof_shared_buffer* sbuf);
 
-#endif /* CONFIG_OPROFILE */
+#endif /* CONFIG_XEN */
 #endif /* __ASM_XENOPROF_H__ */
linux-2.6-xen-sparse/include/xen/xenoprof.h +3 -7
diff -r 7043f58fc993 -r 7e4eac672ace linux-2.6-xen-sparse/include/xen/xenoprof.h
@@ -22,25 +22,21 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__
+#ifdef CONFIG_XEN
 
-#ifdef CONFIG_OPROFILE
 #include <asm/xenoprof.h>
 
 struct oprofile_operations;
 int xenoprofile_init(struct oprofile_operations * ops);
 void xenoprofile_exit(void);
 
-// for perfmon/xen
-extern int xenoprof_is_primary;
-#define is_xenoprof_primary()	(xenoprof_is_primary)
 struct xenoprof_shared_buffer {
 	char					*buffer;
 	struct xenoprof_arch_shared_buffer	arch;
 };
 #else
-#define xenoprofile_init(ops)	do { } while (0)
+#define xenoprofile_init(ops)	(-ENOSYS)
 #define xenoprofile_exit()	do { } while (0)
-#define is_xenoprof_primary()	(0)
-#endif /* CONFIG_OPROFILE */
 
+#endif /* CONFIG_XEN */
 #endif /* __XEN_XENOPROF_H__ */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#16 lore raw

RE: [PATCH 4/5 TAKE 2] xenoprof: make linux xenoprofcodearch-generic

Quoted 21 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Isaku Yamahata
Sent: Monday, November 20, 2006 9:48 PM
To: Santos, Jose Renato G
Cc: [email protected]; [email protected]
Subject: Re: [Xen-devel] [PATCH 4/5 TAKE 2] xenoprof: make linux xenoprofcodearch-generic

Quoted 7 lines · Jose Renato G

Why perfmon needs to access Oprofile? It should be the other way
around ...
It seems that the only change was to create a new file named
xenoprof_is_primary.c to hold the definition of xenoprof_is_primary
I don't like this. And I don't understand why you need this. You
should deal with IA64 specifics in arch specific code as much as possible. Could you please find an IA64 specific solution

Quoted 6 lines

or explain

Quoted 1 line

why this is needed in the generic part?

I found the way without referencing it so that I made it static.

Good! I am happy with the patches now.
I have tested your patches today on x86 32bit Xen and found no
problem.
I did not test on x86_64 but I do not forsee any problems. I am now able to profile the same domain in different modes (active
and passive) during different profiling sessions, which was not possible before your patches. This is good! Thanks.

Now, it is up to Keir to apply the patches or request any changes

Thanks for providing this.

Regards

Renato

Quoted 107 lines
Quoted 1 line

Also, if sending another patch please send me only the

changes from

Quoted 3 lines

the initial 5 patches you sent me. I would like to see only the changes ...
(do not use this last patch as reference, I am ignoring it)

Here is the patch to follow
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg
00842.html.

To make sure, I also attached the patch for PATCH 4/5 TAKE2
http://lists.xensource.com/archives/html/xen-devel/2006-11/msg
00689.html

thanks,

# HG changeset patch
# User [email protected]
# Date 1164087772 -32400
# Node ID ab6c1b607484d3b273d091a11334a3458d36349c # Parent e8fba03edf517b88a91aee47afbc15ab89e5d434 update xenoprof linux side patch following Renato's comment.
- compilation fix when CONFIG_OPROFILE=m with minor clean up
- don't export xenoprof_is_primary.
PATCHNAME: xenoprof_linux_side_update

diff -r e8fba03edf51 -r ab6c1b607484 linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c --- a/linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c Tue Nov 14 15:34:22 2006 +0900
+++ b/linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c Tue Nov 21 14:42:52 2006 +0900

linux-2.6-xen-sparse/drivers/xen/xenoprof/xenoprofile.c +1 -2
@@ -48,7 +48,7 @@ static void xenoprof_stop(void);  static 
 void xenoprof_stop(void);
 
 static int xenoprof_enabled = 0;
-int xenoprof_is_primary = 0;
+static int xenoprof_is_primary = 0;
 static int active_defined;
 
 /* Number of buffers in shared area (one per VCPU) */ diff 
-r e8fba03edf51 -r ab6c1b607484 

linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h
---
a/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xen
oprof.h Tue Nov 14 15:34:22 2006 +0900
+++
b/linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xen
oprof.h Tue Nov 21 14:42:52 2006 +0900

linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h +1 -1
@@ -21,7 +21,7 @@
  */
 #ifndef __ASM_XENOPROF_H__
 #define __ASM_XENOPROF_H__
-#ifdef CONFIG_OPROFILE
+#ifdef CONFIG_XEN
 
 struct super_block;
 struct dentry;
@@ -44,5 +44,5 @@ struct xenoprof_passive;  struct 

xenoprof_passive; int xenoprof_arch_set_passive(struct xenoprof_passive* pdomain, struct xenoprof_shared_buffer* sbuf);

linux-2.6-xen-sparse/include/asm-i386/mach-xen/asm/xenoprof.h +1 -1
-#endif /* CONFIG_OPROFILE */
+#endif /* CONFIG_XEN */
 #endif /* __ASM_XENOPROF_H__ */

diff -r e8fba03edf51 -r ab6c1b607484
linux-2.6-xen-sparse/include/xen/xenoprof.h
--- a/linux-2.6-xen-sparse/include/xen/xenoprof.h Tue Nov
14 15:34:22 2006 +0900
+++ b/linux-2.6-xen-sparse/include/xen/xenoprof.h Tue Nov
21 14:42:52 2006 +0900

linux-2.6-xen-sparse/include/xen/xenoprof.h +3 -7
@@ -22,24 +22,21 @@
 
 #ifndef __XEN_XENOPROF_H__
 #define __XEN_XENOPROF_H__
+#ifdef CONFIG_XEN
 
-#ifdef CONFIG_OPROFILE
 #include <asm/xenoprof.h>
 
 struct oprofile_operations;
 int xenoprofile_init(struct oprofile_operations * ops);  
 void xenoprofile_exit(void);
 
-extern int xenoprof_is_primary;
-#define is_xenoprof_primary()	(xenoprof_is_primary)
 struct xenoprof_shared_buffer {
 	char					*buffer;
 	struct xenoprof_arch_shared_buffer	arch;
 };
 #else
-#define xenoprofile_init(ops)	do { } while (0)
+#define xenoprofile_init(ops)	(-ENOSYS)
 #define xenoprofile_exit()	do { } while (0)
-#define is_xenoprof_primary()	(0)
-#endif /* CONFIG_OPROFILE */
 
+#endif /* CONFIG_XEN */
 #endif /* __XEN_XENOPROF_H__ */
 
 
--

yamahata

#17 lore raw

Re: [PATCH 4/5 TAKE 2] xenoprof: make linux xenoprofcodearch-generic

Quoted 9 lines · Jose Renato G

Good! I am happy with the patches now.
I have tested your patches today on x86 32bit Xen and found no
problem.
I did not test on x86_64 but I do not forsee any problems. I am now able to profile the same domain in different modes (active
and passive) during different profiling sessions, which was not possible before your patches. This is good! Thanks.

Now, it is up to Keir to apply the patches or request any changes

Please re-send the patches as a single tarball. I've lost track of the consistent set.

-- Keir

#18 lore raw

Re: [PATCH 4/5 TAKE 2] xenoprof: make linux xenoprofcodearch-generic

Quoted 11 lines · Keir Fraser
Quoted 8 lines · Jose Renato G

Good! I am happy with the patches now.
I have tested your patches today on x86 32bit Xen and found no
problem.
I did not test on x86_64 but I do not forsee any problems. I am now able to profile the same domain in different modes (active
and passive) during different profiling sessions, which was not possible before your patches. This is good! Thanks.

Quoted 4 lines
Quoted 1 line

Now, it is up to Keir to apply the patches or request any changes

Please re-send the patches as a single tarball. I've lost track of the consistent set.

Attached. Please find it.
Thanks.

Signature · 1 line
yamahata

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#19 lore raw

Re: [PATCH 4/5 TAKE 2] xenoprof: make linux xenoprofcodearch-generic

Accidentaly the attached patch was dropped.
Please apply this too.

Quoted 28 lines · Isaku Yamahata
Quoted 11 lines · Keir Fraser
Quoted 8 lines · Jose Renato G

Good! I am happy with the patches now.
I have tested your patches today on x86 32bit Xen and found no
problem.
I did not test on x86_64 but I do not forsee any problems. I am now able to profile the same domain in different modes (active
and passive) during different profiling sessions, which was not possible before your patches. This is good! Thanks.

Quoted 4 lines
Quoted 1 line

Now, it is up to Keir to apply the patches or request any changes

Please re-send the patches as a single tarball. I've lost track of the consistent set.

Attached. Please find it.
Thanks.

Signature · 7 lines
yamahata


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel
Signature · 1 line
yamahata

# HG changeset patch
# User [email protected]
# Date 1164196036 -32400
# Node ID 521c5ac07bb10335df87413cfb1a543b59f8d640 # Parent 18cd7d8869490c5662056c9c52d617c02d7c2003 [XENOPROFILE] removed unused gmaddr argument.

xen/common/xenoprof.c +5 -9
diff -r 18cd7d886949 -r 521c5ac07bb1 xen/common/xenoprof.c
@@ -128,7 +128,7 @@ xenoprof_shared_gmfn_with_guest(
     }
 }
 
-static char *alloc_xenoprof_buf(struct domain *d, int npages, uint64_t gmaddr)
+static char *alloc_xenoprof_buf(struct domain *d, int npages)
 {
     char *rawbuf;
     int order;
@@ -146,7 +146,7 @@ static char *alloc_xenoprof_buf(struct d
 }
 
 static int alloc_xenoprof_struct(
-    struct domain *d, int max_samples, int is_passive, uint64_t gmaddr)
+    struct domain *d, int max_samples, int is_passive)
 {
     struct vcpu *v;
     int nvcpu, npages, bufsize, max_bufsize;
@@ -179,8 +179,7 @@ static int alloc_xenoprof_struct(
         (max_samples - 1) * sizeof(struct event_log);
     npages = (nvcpu * bufsize - 1) / PAGE_SIZE + 1;
     
-    d->xenoprof->rawbuf = alloc_xenoprof_buf(is_passive ? dom0 : d, npages,
-                                             gmaddr);
+    d->xenoprof->rawbuf = alloc_xenoprof_buf(is_passive ? dom0 : d, npages);
 
     if ( d->xenoprof->rawbuf == NULL )
     {
@@ -368,8 +367,7 @@ static int add_passive_list(XEN_GUEST_HA
 
     if ( d->xenoprof == NULL )
     {
-        ret = alloc_xenoprof_struct(
-            d, passive.max_samples, 1, passive.buf_gmaddr);
+        ret = alloc_xenoprof_struct(d, passive.max_samples, 1);
         if ( ret < 0 )
         {
             put_domain(d);
@@ -509,9 +507,7 @@ static int xenoprof_op_get_buffer(XEN_GU
      */
     if ( d->xenoprof == NULL )
     {
-        ret = alloc_xenoprof_struct(
-            d, xenoprof_get_buffer.max_samples, 0,
-            xenoprof_get_buffer.buf_gmaddr);
+        ret = alloc_xenoprof_struct(d, xenoprof_get_buffer.max_samples, 0);
         if ( ret < 0 )
             return ret;
     }

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#20 lore raw

PATCH 5/5 xenoprof: make xen xenoprof code arch-generic

In reply to Isaku Yamahata

# HG changeset patch
# User [email protected]
# Date 1163486063 -32400
# Node ID 236b3f5ec6bfef2971864dd7bb16f286e5e83a83
# Parent 3bebc37b149280f5ff1e6091d578c7da73820f16
make xenoprof arch-generic with dynamic mapping/unmapping xenoprof buffer support and auto translated mode support.
renamed xenoprof_get_buffer::buf_maddr, xenoprof_passive::buf_maddr to xenoprof_get_buffer::buf_gmaddr, xenoprof_passive::buf_gmaddr to support auto translated mode. With auto translated mode enabled, it is gmaddr, not maddr.
PATCHNAME: make_xenoprof_of_xen_side_arch_generic

linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +2 -2
diff -r 3bebc37b1492 -r 236b3f5ec6bf linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
@@ -93,7 +93,7 @@ int xenoprof_arch_map_shared_buffer(stru
 
 	if ( (ret = direct_kernel_remap_pfn_range(
 		      (unsigned long)area->addr,
-		      get_buffer->buf_maddr >> PAGE_SHIFT,
+		      get_buffer->buf_gmaddr >> PAGE_SHIFT,
 		      npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE),
 		      DOMID_SELF)) ) {
 		vunmap(area->addr);
@@ -127,7 +127,7 @@ int xenoprof_arch_set_passive(struct xen
 
 	ret = direct_kernel_remap_pfn_range(
 		(unsigned long)area->addr,
-		pdomain->buf_maddr >> PAGE_SHIFT,
+		pdomain->buf_gmaddr >> PAGE_SHIFT,
 		npages * PAGE_SIZE, prot, DOMID_SELF);
 	if (ret) {
 		vunmap(area->addr);
xen/arch/x86/oprofile/nmi_int.c +2 -3
diff -r 3bebc37b1492 -r 236b3f5ec6bf xen/arch/x86/oprofile/nmi_int.c
@@ -33,7 +33,6 @@ static unsigned long saved_lvtpc[NR_CPUS
 #define VIRQ_BITMASK_SIZE (MAX_OPROF_DOMAINS/32 + 1)
 extern int active_domains[MAX_OPROF_DOMAINS];
 extern unsigned int adomains;
-extern struct domain *primary_profiler;
 extern struct domain *adomain_ptrs[MAX_OPROF_DOMAINS];
 extern unsigned long virq_ovf_pending[VIRQ_BITMASK_SIZE];
 extern int is_active(struct domain *d);
@@ -337,10 +336,10 @@ int nmi_init(int *num_events, int *is_pr
 		return -ENODEV;
 	}
 
-	if (primary_profiler == NULL) {
+	if (xenoprof_primary_profiler == NULL) {
 		/* For now, only dom0 can be the primary profiler */
 		if (current->domain->domain_id == 0) {
-			primary_profiler = current->domain;
+			xenoprof_primary_profiler = current->domain;
 			prim = 1;
 		}
 	}
xen/common/xenoprof.c +98 -25

245 lines not on this page · raw message

xen/include/asm-x86/xenoprof.h +11 -0
diff -r 3bebc37b1492 -r 236b3f5ec6bf xen/include/asm-x86/xenoprof.h
@@ -45,6 +45,17 @@ void nmi_release_counters(void);
 
 int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
 
+struct vcpu;
+struct cpu_user_regs;
+int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs);
+#define xenoprof_shared_gmfn(d, gmaddr, maddr)                      \
+    do {                                                            \
+        (void)(maddr);                                              \
+        gdprintk(XENLOG_ERR,                                        \
+                 "xenoprof/x86 with autotranslated mode enabled"    \
+                 "isn't supported yet\n");                          \
+    } while (0)
+
 #endif /* __ASM_XENOPROF_H__ */
 
 /*
xen/include/public/xenoprof.h +2 -2
diff -r 3bebc37b1492 -r 236b3f5ec6bf xen/include/public/xenoprof.h
@@ -87,7 +87,7 @@ struct xenoprof_get_buffer {
     int32_t  max_samples;
     int32_t  nbuf;
     int32_t  bufsize;
-    uint64_t buf_maddr;
+    uint64_t buf_gmaddr;
 };
 typedef struct xenoprof_get_buffer xenoprof_get_buffer_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_get_buffer_t);
@@ -110,7 +110,7 @@ typedef struct xenoprof_passive {
     int32_t  max_samples;
     int32_t  nbuf;
     int32_t  bufsize;
-    uint64_t buf_maddr;
+    uint64_t buf_gmaddr;
 } xenoprof_passive_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t);
 
xen/include/xen/xenoprof.h +4 -0
diff -r 3bebc37b1492 -r 236b3f5ec6bf xen/include/xen/xenoprof.h
@@ -41,4 +41,8 @@ struct domain;
 struct domain;
 void free_xenoprof_pages(struct domain *d);
 
+int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg);
+
+extern struct domain *xenoprof_primary_profiler;
+
 #endif  /* __XEN__XENOPROF_H__ */

yamahata

#21 lore raw

Re: [PATCH 5/5 TAKE 2] xenoprof: make xen xenoprof code arch-generic

Updated following Renato's comments.

Changes
- changed alloc_xenoprof_buf() signature. removed third gmaddr argument.

# HG changeset patch
# User [email protected]
# Date 1163486063 -32400
# Node ID 996212ae7f052348a22f8c06d5a2958fca39c6ff
# Parent 9bf71c7abb2de71ac233c24d821978ce2e6cc961
make xenoprof arch-generic with dynamic mapping/unmapping xenoprof buffer support and auto translated mode support.
renamed xenoprof_get_buffer::buf_maddr, xenoprof_passive::buf_maddr to xenoprof_get_buffer::buf_gmaddr, xenoprof_passive::buf_gmaddr to support auto translated mode. With auto translated mode enabled, it is gmaddr, not maddr.
PATCHNAME: make_xenoprof_of_xen_side_arch_generic

linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +2 -2
diff -r 9bf71c7abb2d -r 996212ae7f05 linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
@@ -93,7 +93,7 @@ int xenoprof_arch_map_shared_buffer(stru
 
 	if ( (ret = direct_kernel_remap_pfn_range(
 		      (unsigned long)area->addr,
-		      get_buffer->buf_maddr >> PAGE_SHIFT,
+		      get_buffer->buf_gmaddr >> PAGE_SHIFT,
 		      npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE),
 		      DOMID_SELF)) ) {
 		vunmap(area->addr);
@@ -127,7 +127,7 @@ int xenoprof_arch_set_passive(struct xen
 
 	ret = direct_kernel_remap_pfn_range(
 		(unsigned long)area->addr,
-		pdomain->buf_maddr >> PAGE_SHIFT,
+		pdomain->buf_gmaddr >> PAGE_SHIFT,
 		npages * PAGE_SIZE, prot, DOMID_SELF);
 	if (ret) {
 		vunmap(area->addr);
xen/arch/x86/oprofile/nmi_int.c +2 -3
diff -r 9bf71c7abb2d -r 996212ae7f05 xen/arch/x86/oprofile/nmi_int.c
@@ -33,7 +33,6 @@ static unsigned long saved_lvtpc[NR_CPUS
 #define VIRQ_BITMASK_SIZE (MAX_OPROF_DOMAINS/32 + 1)
 extern int active_domains[MAX_OPROF_DOMAINS];
 extern unsigned int adomains;
-extern struct domain *primary_profiler;
 extern struct domain *adomain_ptrs[MAX_OPROF_DOMAINS];
 extern unsigned long virq_ovf_pending[VIRQ_BITMASK_SIZE];
 extern int is_active(struct domain *d);
@@ -337,10 +336,10 @@ int nmi_init(int *num_events, int *is_pr
 		return -ENODEV;
 	}
 
-	if (primary_profiler == NULL) {
+	if (xenoprof_primary_profiler == NULL) {
 		/* For now, only dom0 can be the primary profiler */
 		if (current->domain->domain_id == 0) {
-			primary_profiler = current->domain;
+			xenoprof_primary_profiler = current->domain;
 			prim = 1;
 		}
 	}
xen/common/xenoprof.c +95 -23

235 lines not on this page · raw message

xen/include/asm-x86/xenoprof.h +11 -0
diff -r 9bf71c7abb2d -r 996212ae7f05 xen/include/asm-x86/xenoprof.h
@@ -45,6 +45,17 @@ void nmi_release_counters(void);
 
 int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
 
+struct vcpu;
+struct cpu_user_regs;
+int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs);
+#define xenoprof_shared_gmfn(d, gmaddr, maddr)                      \
+    do {                                                            \
+        (void)(maddr);                                              \
+        gdprintk(XENLOG_ERR,                                        \
+                 "xenoprof/x86 with autotranslated mode enabled"    \
+                 "isn't supported yet\n");                          \
+    } while (0)
+
 #endif /* __ASM_XENOPROF_H__ */
 
 /*
xen/include/public/xenoprof.h +2 -2
diff -r 9bf71c7abb2d -r 996212ae7f05 xen/include/public/xenoprof.h
@@ -87,7 +87,7 @@ struct xenoprof_get_buffer {
     int32_t  max_samples;
     int32_t  nbuf;
     int32_t  bufsize;
-    uint64_t buf_maddr;
+    uint64_t buf_gmaddr;
 };
 typedef struct xenoprof_get_buffer xenoprof_get_buffer_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_get_buffer_t);
@@ -110,7 +110,7 @@ typedef struct xenoprof_passive {
     int32_t  max_samples;
     int32_t  nbuf;
     int32_t  bufsize;
-    uint64_t buf_maddr;
+    uint64_t buf_gmaddr;
 } xenoprof_passive_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t);
 
xen/include/xen/xenoprof.h +4 -0
diff -r 9bf71c7abb2d -r 996212ae7f05 xen/include/xen/xenoprof.h
@@ -41,4 +41,8 @@ struct domain;
 struct domain;
 void free_xenoprof_pages(struct domain *d);
 
+int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg);
+
+extern struct domain *xenoprof_primary_profiler;
+
 #endif  /* __XEN__XENOPROF_H__ */
Signature · 1 line
yamahata

# HG changeset patch
# User [email protected]
# Date 1163486063 -32400
# Node ID 996212ae7f052348a22f8c06d5a2958fca39c6ff
# Parent 9bf71c7abb2de71ac233c24d821978ce2e6cc961
make xenoprof arch-generic with dynamic mapping/unmapping xenoprof buffer support and auto translated mode support.
renamed xenoprof_get_buffer::buf_maddr, xenoprof_passive::buf_maddr to xenoprof_get_buffer::buf_gmaddr, xenoprof_passive::buf_gmaddr to support auto translated mode. With auto translated mode enabled, it is gmaddr, not maddr.
PATCHNAME: make_xenoprof_of_xen_side_arch_generic

linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +2 -2
diff -r 9bf71c7abb2d -r 996212ae7f05 linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
@@ -93,7 +93,7 @@ int xenoprof_arch_map_shared_buffer(stru
 
 	if ( (ret = direct_kernel_remap_pfn_range(
 		      (unsigned long)area->addr,
-		      get_buffer->buf_maddr >> PAGE_SHIFT,
+		      get_buffer->buf_gmaddr >> PAGE_SHIFT,
 		      npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE),
 		      DOMID_SELF)) ) {
 		vunmap(area->addr);
@@ -127,7 +127,7 @@ int xenoprof_arch_set_passive(struct xen
 
 	ret = direct_kernel_remap_pfn_range(
 		(unsigned long)area->addr,
-		pdomain->buf_maddr >> PAGE_SHIFT,
+		pdomain->buf_gmaddr >> PAGE_SHIFT,
 		npages * PAGE_SIZE, prot, DOMID_SELF);
 	if (ret) {
 		vunmap(area->addr);
xen/arch/x86/oprofile/nmi_int.c +2 -3
diff -r 9bf71c7abb2d -r 996212ae7f05 xen/arch/x86/oprofile/nmi_int.c
@@ -33,7 +33,6 @@ static unsigned long saved_lvtpc[NR_CPUS
 #define VIRQ_BITMASK_SIZE (MAX_OPROF_DOMAINS/32 + 1)
 extern int active_domains[MAX_OPROF_DOMAINS];
 extern unsigned int adomains;
-extern struct domain *primary_profiler;
 extern struct domain *adomain_ptrs[MAX_OPROF_DOMAINS];
 extern unsigned long virq_ovf_pending[VIRQ_BITMASK_SIZE];
 extern int is_active(struct domain *d);
@@ -337,10 +336,10 @@ int nmi_init(int *num_events, int *is_pr
 		return -ENODEV;
 	}
 
-	if (primary_profiler == NULL) {
+	if (xenoprof_primary_profiler == NULL) {
 		/* For now, only dom0 can be the primary profiler */
 		if (current->domain->domain_id == 0) {
-			primary_profiler = current->domain;
+			xenoprof_primary_profiler = current->domain;
 			prim = 1;
 		}
 	}
xen/common/xenoprof.c +95 -23

235 lines not on this page · raw message

xen/include/asm-x86/xenoprof.h +11 -0
diff -r 9bf71c7abb2d -r 996212ae7f05 xen/include/asm-x86/xenoprof.h
@@ -45,6 +45,17 @@ void nmi_release_counters(void);
 
 int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
 
+struct vcpu;
+struct cpu_user_regs;
+int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs);
+#define xenoprof_shared_gmfn(d, gmaddr, maddr)                      \
+    do {                                                            \
+        (void)(maddr);                                              \
+        gdprintk(XENLOG_ERR,                                        \
+                 "xenoprof/x86 with autotranslated mode enabled"    \
+                 "isn't supported yet\n");                          \
+    } while (0)
+
 #endif /* __ASM_XENOPROF_H__ */
 
 /*
xen/include/public/xenoprof.h +2 -2
diff -r 9bf71c7abb2d -r 996212ae7f05 xen/include/public/xenoprof.h
@@ -87,7 +87,7 @@ struct xenoprof_get_buffer {
     int32_t  max_samples;
     int32_t  nbuf;
     int32_t  bufsize;
-    uint64_t buf_maddr;
+    uint64_t buf_gmaddr;
 };
 typedef struct xenoprof_get_buffer xenoprof_get_buffer_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_get_buffer_t);
@@ -110,7 +110,7 @@ typedef struct xenoprof_passive {
     int32_t  max_samples;
     int32_t  nbuf;
     int32_t  bufsize;
-    uint64_t buf_maddr;
+    uint64_t buf_gmaddr;
 } xenoprof_passive_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t);
 
xen/include/xen/xenoprof.h +4 -0
diff -r 9bf71c7abb2d -r 996212ae7f05 xen/include/xen/xenoprof.h
@@ -41,4 +41,8 @@ struct domain;
 struct domain;
 void free_xenoprof_pages(struct domain *d);
 
+int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg);
+
+extern struct domain *xenoprof_primary_profiler;
+
 #endif  /* __XEN__XENOPROF_H__ */

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#22 lore raw

Re: [Xen-devel] [PATCH 5/5 TAKE 2] xenoprof: make xen xenoprof code arch-generic

I sent out my old patch. Sorry for confusion.

# HG changeset patch
# User [email protected]
# Date 1163658590 -32400
# Node ID 2619990fdf3716dacd62f673d1259df26e717e57
# Parent 9bf71c7abb2de71ac233c24d821978ce2e6cc961
make xenoprof arch-generic with dynamic mapping/unmapping xenoprof buffer support and auto translated mode support.
renamed xenoprof_get_buffer::buf_maddr, xenoprof_passive::buf_maddr to xenoprof_get_buffer::buf_gmaddr, xenoprof_passive::buf_gmaddr to support auto translated mode. With auto translated mode enabled, it is gmaddr, not maddr.
PATCHNAME: make_xenoprof_of_xen_side_arch_generic

linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +2 -2
diff -r 9bf71c7abb2d -r 2619990fdf37 linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
@@ -93,7 +93,7 @@ int xenoprof_arch_map_shared_buffer(stru
 
 	if ( (ret = direct_kernel_remap_pfn_range(
 		      (unsigned long)area->addr,
-		      get_buffer->buf_maddr >> PAGE_SHIFT,
+		      get_buffer->buf_gmaddr >> PAGE_SHIFT,
 		      npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE),
 		      DOMID_SELF)) ) {
 		vunmap(area->addr);
@@ -127,7 +127,7 @@ int xenoprof_arch_set_passive(struct xen
 
 	ret = direct_kernel_remap_pfn_range(
 		(unsigned long)area->addr,
-		pdomain->buf_maddr >> PAGE_SHIFT,
+		pdomain->buf_gmaddr >> PAGE_SHIFT,
 		npages * PAGE_SIZE, prot, DOMID_SELF);
 	if (ret) {
 		vunmap(area->addr);
xen/arch/x86/oprofile/nmi_int.c +2 -3
diff -r 9bf71c7abb2d -r 2619990fdf37 xen/arch/x86/oprofile/nmi_int.c
@@ -33,7 +33,6 @@ static unsigned long saved_lvtpc[NR_CPUS
 #define VIRQ_BITMASK_SIZE (MAX_OPROF_DOMAINS/32 + 1)
 extern int active_domains[MAX_OPROF_DOMAINS];
 extern unsigned int adomains;
-extern struct domain *primary_profiler;
 extern struct domain *adomain_ptrs[MAX_OPROF_DOMAINS];
 extern unsigned long virq_ovf_pending[VIRQ_BITMASK_SIZE];
 extern int is_active(struct domain *d);
@@ -337,10 +336,10 @@ int nmi_init(int *num_events, int *is_pr
 		return -ENODEV;
 	}
 
-	if (primary_profiler == NULL) {
+	if (xenoprof_primary_profiler == NULL) {
 		/* For now, only dom0 can be the primary profiler */
 		if (current->domain->domain_id == 0) {
-			primary_profiler = current->domain;
+			xenoprof_primary_profiler = current->domain;
 			prim = 1;
 		}
 	}
xen/common/xenoprof.c +90 -19

210 lines not on this page · raw message

xen/include/asm-x86/xenoprof.h +11 -0
diff -r 9bf71c7abb2d -r 2619990fdf37 xen/include/asm-x86/xenoprof.h
@@ -45,6 +45,17 @@ void nmi_release_counters(void);
 
 int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
 
+struct vcpu;
+struct cpu_user_regs;
+int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs);
+#define xenoprof_shared_gmfn(d, gmaddr, maddr)                      \
+    do {                                                            \
+        (void)(maddr);                                              \
+        gdprintk(XENLOG_ERR,                                        \
+                 "xenoprof/x86 with autotranslated mode enabled"    \
+                 "isn't supported yet\n");                          \
+    } while (0)
+
 #endif /* __ASM_XENOPROF_H__ */
 
 /*
xen/include/public/xenoprof.h +2 -2
diff -r 9bf71c7abb2d -r 2619990fdf37 xen/include/public/xenoprof.h
@@ -87,7 +87,7 @@ struct xenoprof_get_buffer {
     int32_t  max_samples;
     int32_t  nbuf;
     int32_t  bufsize;
-    uint64_t buf_maddr;
+    uint64_t buf_gmaddr;
 };
 typedef struct xenoprof_get_buffer xenoprof_get_buffer_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_get_buffer_t);
@@ -110,7 +110,7 @@ typedef struct xenoprof_passive {
     int32_t  max_samples;
     int32_t  nbuf;
     int32_t  bufsize;
-    uint64_t buf_maddr;
+    uint64_t buf_gmaddr;
 } xenoprof_passive_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t);
 
xen/include/xen/xenoprof.h +4 -0
diff -r 9bf71c7abb2d -r 2619990fdf37 xen/include/xen/xenoprof.h
@@ -41,4 +41,8 @@ struct domain;
 struct domain;
 void free_xenoprof_pages(struct domain *d);
 
+int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg);
+
+extern struct domain *xenoprof_primary_profiler;
+
 #endif  /* __XEN__XENOPROF_H__ */
Signature · 1 line
yamahata

# HG changeset patch
# User [email protected]
# Date 1163658590 -32400
# Node ID 2619990fdf3716dacd62f673d1259df26e717e57
# Parent 9bf71c7abb2de71ac233c24d821978ce2e6cc961
make xenoprof arch-generic with dynamic mapping/unmapping xenoprof buffer support and auto translated mode support.
renamed xenoprof_get_buffer::buf_maddr, xenoprof_passive::buf_maddr to xenoprof_get_buffer::buf_gmaddr, xenoprof_passive::buf_gmaddr to support auto translated mode. With auto translated mode enabled, it is gmaddr, not maddr.
PATCHNAME: make_xenoprof_of_xen_side_arch_generic

linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c +2 -2
diff -r 9bf71c7abb2d -r 2619990fdf37 linux-2.6-xen-sparse/arch/i386/oprofile/xenoprof.c
@@ -93,7 +93,7 @@ int xenoprof_arch_map_shared_buffer(stru
 
 	if ( (ret = direct_kernel_remap_pfn_range(
 		      (unsigned long)area->addr,
-		      get_buffer->buf_maddr >> PAGE_SHIFT,
+		      get_buffer->buf_gmaddr >> PAGE_SHIFT,
 		      npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE),
 		      DOMID_SELF)) ) {
 		vunmap(area->addr);
@@ -127,7 +127,7 @@ int xenoprof_arch_set_passive(struct xen
 
 	ret = direct_kernel_remap_pfn_range(
 		(unsigned long)area->addr,
-		pdomain->buf_maddr >> PAGE_SHIFT,
+		pdomain->buf_gmaddr >> PAGE_SHIFT,
 		npages * PAGE_SIZE, prot, DOMID_SELF);
 	if (ret) {
 		vunmap(area->addr);
xen/arch/x86/oprofile/nmi_int.c +2 -3
diff -r 9bf71c7abb2d -r 2619990fdf37 xen/arch/x86/oprofile/nmi_int.c
@@ -33,7 +33,6 @@ static unsigned long saved_lvtpc[NR_CPUS
 #define VIRQ_BITMASK_SIZE (MAX_OPROF_DOMAINS/32 + 1)
 extern int active_domains[MAX_OPROF_DOMAINS];
 extern unsigned int adomains;
-extern struct domain *primary_profiler;
 extern struct domain *adomain_ptrs[MAX_OPROF_DOMAINS];
 extern unsigned long virq_ovf_pending[VIRQ_BITMASK_SIZE];
 extern int is_active(struct domain *d);
@@ -337,10 +336,10 @@ int nmi_init(int *num_events, int *is_pr
 		return -ENODEV;
 	}
 
-	if (primary_profiler == NULL) {
+	if (xenoprof_primary_profiler == NULL) {
 		/* For now, only dom0 can be the primary profiler */
 		if (current->domain->domain_id == 0) {
-			primary_profiler = current->domain;
+			xenoprof_primary_profiler = current->domain;
 			prim = 1;
 		}
 	}
xen/common/xenoprof.c +90 -19

210 lines not on this page · raw message

xen/include/asm-x86/xenoprof.h +11 -0
diff -r 9bf71c7abb2d -r 2619990fdf37 xen/include/asm-x86/xenoprof.h
@@ -45,6 +45,17 @@ void nmi_release_counters(void);
 
 int xenoprof_arch_counter(XEN_GUEST_HANDLE(void) arg);
 
+struct vcpu;
+struct cpu_user_regs;
+int xenoprofile_get_mode(struct vcpu *v, struct cpu_user_regs * const regs);
+#define xenoprof_shared_gmfn(d, gmaddr, maddr)                      \
+    do {                                                            \
+        (void)(maddr);                                              \
+        gdprintk(XENLOG_ERR,                                        \
+                 "xenoprof/x86 with autotranslated mode enabled"    \
+                 "isn't supported yet\n");                          \
+    } while (0)
+
 #endif /* __ASM_XENOPROF_H__ */
 
 /*
xen/include/public/xenoprof.h +2 -2
diff -r 9bf71c7abb2d -r 2619990fdf37 xen/include/public/xenoprof.h
@@ -87,7 +87,7 @@ struct xenoprof_get_buffer {
     int32_t  max_samples;
     int32_t  nbuf;
     int32_t  bufsize;
-    uint64_t buf_maddr;
+    uint64_t buf_gmaddr;
 };
 typedef struct xenoprof_get_buffer xenoprof_get_buffer_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_get_buffer_t);
@@ -110,7 +110,7 @@ typedef struct xenoprof_passive {
     int32_t  max_samples;
     int32_t  nbuf;
     int32_t  bufsize;
-    uint64_t buf_maddr;
+    uint64_t buf_gmaddr;
 } xenoprof_passive_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_passive_t);
 
xen/include/xen/xenoprof.h +4 -0
diff -r 9bf71c7abb2d -r 2619990fdf37 xen/include/xen/xenoprof.h
@@ -41,4 +41,8 @@ struct domain;
 struct domain;
 void free_xenoprof_pages(struct domain *d);
 
+int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg);
+
+extern struct domain *xenoprof_primary_profiler;
+
 #endif  /* __XEN__XENOPROF_H__ */

_______________________________________________
Xen-ia64-devel mailing list
[email protected]
http://lists.xensource.com/xen-ia64-devel

#23 lore raw
In reply to Isaku Yamahata

Renato needs to review and ack these patches before I'll apply them.

-- Keir

Quoted 26 lines · Isaku Yamahata

Those patches are preliminary clean-ups to support xenoprof on ia64. They split the current x86-specific code into arch dependent/independent code and make them more arch-generic.
Those include also bug fixes, clean-ups and dynamic mapping/unmapping xenoprof buffer support. I'll post the IA64 part to xen-ia64-devel.

[PATCH 1/5] xenoprof: split xen x86 xenoprof code [PATCH 2/5] xenoprof: make xen xenoprof code slight arch-generic [PATCH 3/5] xenoprof: split linux x86 xenoprof code [PATCH 4/5] xenoprof: make linux xenoprof code arch-generic [PATCH 5/5] xenoprof: make xen xenoprof code arch-generic

Changes:

TAKE 2
- broke patches into smaller ones for review.
The final code is almost same as TAKE 1.

thanks
yamahata

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel