* [PATCH 1/6] trace: share t_info pages only in read-only mode
@ 2010-06-29 15:31 Jan Beulich
2010-06-29 16:27 ` George Dunlap
0 siblings, 1 reply; 2+ messages in thread
From: Jan Beulich @ 2010-06-29 15:31 UTC (permalink / raw)
To: George Dunlap; +Cc: xen-devel
[-- Attachment #1: Type: text/plain, Size: 3566 bytes --]
There's no need to share writably the t_info pages (Dom0 only wants
[and needs] to read it)
Signed-off-by: Jan Beulich <jbeulich@novell.com>
--- 2010-06-15.orig/tools/xenmon/xenbaked.c 2010-06-29 16:55:30.000000000 +0200
+++ 2010-06-15/tools/xenmon/xenbaked.c 2010-06-28 10:23:01.000000000 +0200
@@ -84,7 +84,7 @@ typedef struct settings_st {
} settings_t;
struct t_struct {
- struct t_info *t_info; /* Structure with information about individual buffers */
+ const struct t_info *t_info; /* Structure with information about individual buffers */
struct t_buf **meta; /* Pointers to trace buffer metadata */
unsigned char **data; /* Pointers to trace buffer data areas */
};
@@ -376,9 +376,8 @@ static struct t_struct *map_tbufs(unsign
}
/* Map t_info metadata structure */
- tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN,
- tinfo_size, PROT_READ | PROT_WRITE,
- tbufs_mfn);
+ tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN, tinfo_size,
+ PROT_READ, tbufs_mfn);
if ( tbufs.t_info == 0 )
{
@@ -404,7 +403,8 @@ static struct t_struct *map_tbufs(unsign
for(i=0; i<num; i++)
{
- uint32_t *mfn_list = ((uint32_t *)tbufs.t_info) + tbufs.t_info->mfn_offset[i];
+ const uint32_t *mfn_list = (const uint32_t *)tbufs.t_info
+ + tbufs.t_info->mfn_offset[i];
int j;
xen_pfn_t pfn_list[tbufs.t_info->tbuf_size];
--- 2010-06-15.orig/tools/xentrace/xentrace.c 2010-06-29 16:55:30.000000000 +0200
+++ 2010-06-15/tools/xentrace/xentrace.c 2010-06-28 10:23:26.000000000 +0200
@@ -63,7 +63,7 @@ typedef struct settings_st {
} settings_t;
struct t_struct {
- struct t_info *t_info; /* Structure with information about individual buffers */
+ const struct t_info *t_info; /* Structure with information about individual buffers */
struct t_buf **meta; /* Pointers to trace buffer metadata */
unsigned char **data; /* Pointers to trace buffer data areas */
};
@@ -475,9 +475,8 @@ static struct t_struct *map_tbufs(unsign
int i;
/* Map t_info metadata structure */
- tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN,
- tinfo_size, PROT_READ | PROT_WRITE,
- tbufs_mfn);
+ tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN, tinfo_size,
+ PROT_READ, tbufs_mfn);
if ( tbufs.t_info == 0 )
{
@@ -503,7 +502,8 @@ static struct t_struct *map_tbufs(unsign
for(i=0; i<num; i++)
{
- uint32_t *mfn_list = ((uint32_t *)tbufs.t_info) + tbufs.t_info->mfn_offset[i];
+ const uint32_t *mfn_list = (const uint32_t *)tbufs.t_info
+ + tbufs.t_info->mfn_offset[i];
int j;
xen_pfn_t pfn_list[tbufs.t_info->tbuf_size];
--- 2010-06-15.orig/xen/common/trace.c 2010-06-28 12:16:05.000000000 +0200
+++ 2010-06-15/xen/common/trace.c 2010-06-28 11:58:37.000000000 +0200
@@ -309,7 +309,7 @@ void __init init_trace_bufs(void)
for(i=0; i<T_INFO_PAGES; i++)
share_xen_page_with_privileged_guests(
- virt_to_page(t_info) + i, XENSHARE_writable);
+ virt_to_page(t_info) + i, XENSHARE_readonly);
if ( opt_tbuf_size == 0 )
{
[-- Attachment #2: trace-t_info-readonly.patch --]
[-- Type: text/plain, Size: 3560 bytes --]
There's no need to share writably the t_info pages (Dom0 only wants
[and needs] to read it)
Signed-off-by: Jan Beulich <jbeulich@novell.com>
--- 2010-06-15.orig/tools/xenmon/xenbaked.c 2010-06-29 16:55:30.000000000 +0200
+++ 2010-06-15/tools/xenmon/xenbaked.c 2010-06-28 10:23:01.000000000 +0200
@@ -84,7 +84,7 @@ typedef struct settings_st {
} settings_t;
struct t_struct {
- struct t_info *t_info; /* Structure with information about individual buffers */
+ const struct t_info *t_info; /* Structure with information about individual buffers */
struct t_buf **meta; /* Pointers to trace buffer metadata */
unsigned char **data; /* Pointers to trace buffer data areas */
};
@@ -376,9 +376,8 @@ static struct t_struct *map_tbufs(unsign
}
/* Map t_info metadata structure */
- tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN,
- tinfo_size, PROT_READ | PROT_WRITE,
- tbufs_mfn);
+ tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN, tinfo_size,
+ PROT_READ, tbufs_mfn);
if ( tbufs.t_info == 0 )
{
@@ -404,7 +403,8 @@ static struct t_struct *map_tbufs(unsign
for(i=0; i<num; i++)
{
- uint32_t *mfn_list = ((uint32_t *)tbufs.t_info) + tbufs.t_info->mfn_offset[i];
+ const uint32_t *mfn_list = (const uint32_t *)tbufs.t_info
+ + tbufs.t_info->mfn_offset[i];
int j;
xen_pfn_t pfn_list[tbufs.t_info->tbuf_size];
--- 2010-06-15.orig/tools/xentrace/xentrace.c 2010-06-29 16:55:30.000000000 +0200
+++ 2010-06-15/tools/xentrace/xentrace.c 2010-06-28 10:23:26.000000000 +0200
@@ -63,7 +63,7 @@ typedef struct settings_st {
} settings_t;
struct t_struct {
- struct t_info *t_info; /* Structure with information about individual buffers */
+ const struct t_info *t_info; /* Structure with information about individual buffers */
struct t_buf **meta; /* Pointers to trace buffer metadata */
unsigned char **data; /* Pointers to trace buffer data areas */
};
@@ -475,9 +475,8 @@ static struct t_struct *map_tbufs(unsign
int i;
/* Map t_info metadata structure */
- tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN,
- tinfo_size, PROT_READ | PROT_WRITE,
- tbufs_mfn);
+ tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN, tinfo_size,
+ PROT_READ, tbufs_mfn);
if ( tbufs.t_info == 0 )
{
@@ -503,7 +502,8 @@ static struct t_struct *map_tbufs(unsign
for(i=0; i<num; i++)
{
- uint32_t *mfn_list = ((uint32_t *)tbufs.t_info) + tbufs.t_info->mfn_offset[i];
+ const uint32_t *mfn_list = (const uint32_t *)tbufs.t_info
+ + tbufs.t_info->mfn_offset[i];
int j;
xen_pfn_t pfn_list[tbufs.t_info->tbuf_size];
--- 2010-06-15.orig/xen/common/trace.c 2010-06-28 12:16:05.000000000 +0200
+++ 2010-06-15/xen/common/trace.c 2010-06-28 11:58:37.000000000 +0200
@@ -309,7 +309,7 @@ void __init init_trace_bufs(void)
for(i=0; i<T_INFO_PAGES; i++)
share_xen_page_with_privileged_guests(
- virt_to_page(t_info) + i, XENSHARE_writable);
+ virt_to_page(t_info) + i, XENSHARE_readonly);
if ( opt_tbuf_size == 0 )
{
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 1/6] trace: share t_info pages only in read-only mode
2010-06-29 15:31 [PATCH 1/6] trace: share t_info pages only in read-only mode Jan Beulich
@ 2010-06-29 16:27 ` George Dunlap
0 siblings, 0 replies; 2+ messages in thread
From: George Dunlap @ 2010-06-29 16:27 UTC (permalink / raw)
To: Jan Beulich; +Cc: xen-devel
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
On Tue, Jun 29, 2010 at 4:31 PM, Jan Beulich <JBeulich@novell.com> wrote:
> There's no need to share writably the t_info pages (Dom0 only wants
> [and needs] to read it)
>
> Signed-off-by: Jan Beulich <jbeulich@novell.com>
>
> --- 2010-06-15.orig/tools/xenmon/xenbaked.c 2010-06-29 16:55:30.000000000 +0200
> +++ 2010-06-15/tools/xenmon/xenbaked.c 2010-06-28 10:23:01.000000000 +0200
> @@ -84,7 +84,7 @@ typedef struct settings_st {
> } settings_t;
>
> struct t_struct {
> - struct t_info *t_info; /* Structure with information about individual buffers */
> + const struct t_info *t_info; /* Structure with information about individual buffers */
> struct t_buf **meta; /* Pointers to trace buffer metadata */
> unsigned char **data; /* Pointers to trace buffer data areas */
> };
> @@ -376,9 +376,8 @@ static struct t_struct *map_tbufs(unsign
> }
>
> /* Map t_info metadata structure */
> - tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN,
> - tinfo_size, PROT_READ | PROT_WRITE,
> - tbufs_mfn);
> + tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN, tinfo_size,
> + PROT_READ, tbufs_mfn);
>
> if ( tbufs.t_info == 0 )
> {
> @@ -404,7 +403,8 @@ static struct t_struct *map_tbufs(unsign
> for(i=0; i<num; i++)
> {
>
> - uint32_t *mfn_list = ((uint32_t *)tbufs.t_info) + tbufs.t_info->mfn_offset[i];
> + const uint32_t *mfn_list = (const uint32_t *)tbufs.t_info
> + + tbufs.t_info->mfn_offset[i];
> int j;
> xen_pfn_t pfn_list[tbufs.t_info->tbuf_size];
>
> --- 2010-06-15.orig/tools/xentrace/xentrace.c 2010-06-29 16:55:30.000000000 +0200
> +++ 2010-06-15/tools/xentrace/xentrace.c 2010-06-28 10:23:26.000000000 +0200
> @@ -63,7 +63,7 @@ typedef struct settings_st {
> } settings_t;
>
> struct t_struct {
> - struct t_info *t_info; /* Structure with information about individual buffers */
> + const struct t_info *t_info; /* Structure with information about individual buffers */
> struct t_buf **meta; /* Pointers to trace buffer metadata */
> unsigned char **data; /* Pointers to trace buffer data areas */
> };
> @@ -475,9 +475,8 @@ static struct t_struct *map_tbufs(unsign
> int i;
>
> /* Map t_info metadata structure */
> - tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN,
> - tinfo_size, PROT_READ | PROT_WRITE,
> - tbufs_mfn);
> + tbufs.t_info = xc_map_foreign_range(xc_handle, DOMID_XEN, tinfo_size,
> + PROT_READ, tbufs_mfn);
>
> if ( tbufs.t_info == 0 )
> {
> @@ -503,7 +502,8 @@ static struct t_struct *map_tbufs(unsign
> for(i=0; i<num; i++)
> {
>
> - uint32_t *mfn_list = ((uint32_t *)tbufs.t_info) + tbufs.t_info->mfn_offset[i];
> + const uint32_t *mfn_list = (const uint32_t *)tbufs.t_info
> + + tbufs.t_info->mfn_offset[i];
> int j;
> xen_pfn_t pfn_list[tbufs.t_info->tbuf_size];
>
> --- 2010-06-15.orig/xen/common/trace.c 2010-06-28 12:16:05.000000000 +0200
> +++ 2010-06-15/xen/common/trace.c 2010-06-28 11:58:37.000000000 +0200
> @@ -309,7 +309,7 @@ void __init init_trace_bufs(void)
>
> for(i=0; i<T_INFO_PAGES; i++)
> share_xen_page_with_privileged_guests(
> - virt_to_page(t_info) + i, XENSHARE_writable);
> + virt_to_page(t_info) + i, XENSHARE_readonly);
>
> if ( opt_tbuf_size == 0 )
> {
>
>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-06-29 16:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-29 15:31 [PATCH 1/6] trace: share t_info pages only in read-only mode Jan Beulich
2010-06-29 16:27 ` George Dunlap
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).