All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] trace: Fix incorrect number of pages used for trace metadata
@ 2016-09-29 13:53 Igor Druzhinin
  2016-09-30 14:46 ` George Dunlap
  0 siblings, 1 reply; 7+ messages in thread
From: Igor Druzhinin @ 2016-09-29 13:53 UTC (permalink / raw)
  To: xen-devel; +Cc: george.dunlap, Igor Druzhinin

As long as t_info_first_offset is calculated in uint32_t offsets we need to
multiply it by sizeof(uint32_t) in order to get the right number of pages
for trace metadata. Not doing that makes it impossible to read the trace
buffer correctly from userspace for some corner cases.

Signed-off-by: Igor Druzhinin <igor.druzhinin@citrix.com>
---
 xen/common/trace.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xen/common/trace.c b/xen/common/trace.c
index f651cf3..a9563cc 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -149,7 +149,7 @@ static int calculate_tbuf_size(unsigned int pages, uint16_t t_info_first_offset)
     }
 
     t_info_words = num_online_cpus() * pages * sizeof(uint32_t);
-    t_info_pages = PFN_UP(t_info_first_offset + t_info_words);
+    t_info_pages = PFN_UP(t_info_first_offset * sizeof(uint32_t) + t_info_words);
     printk(XENLOG_INFO "xentrace: requesting %u t_info pages "
            "for %u trace pages on %u cpus\n",
            t_info_pages, pages, num_online_cpus());
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

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

end of thread, other threads:[~2016-10-04  9:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-29 13:53 [PATCH] trace: Fix incorrect number of pages used for trace metadata Igor Druzhinin
2016-09-30 14:46 ` George Dunlap
2016-09-30 14:48   ` Andrew Cooper
2016-09-30 14:48   ` George Dunlap
2016-09-30 16:04   ` Igor Druzhinin
2016-09-30 16:12     ` George Dunlap
2016-10-04  9:59       ` Igor Druzhinin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.