[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.6] xen/trace: Fix trace metadata page count calculation (revert fbf96e6)



commit ebc5d6e22c311551dad3349e0328bf57a4184049
Author:     George Dunlap <george.dunlap@xxxxxxxxxx>
AuthorDate: Tue Oct 25 17:17:03 2016 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Oct 25 17:17:03 2016 +0200

    xen/trace: Fix trace metadata page count calculation (revert fbf96e6)
    
    Changeset fbf96e6, "xentrace: correct formula to calculate
    t_info_pages", broke the trace metadata page count calculation, by
    mistaking t_info_first_offset as denominated in bytes, when in fact it
    is denominated in words (uint32_t).
    
    Effectively revert that change, and put a comment there to reduce the
    chance that someone will make that mistake in the future.
    
    Reviewed-by: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
    Tested-by: Igor Druzhinin <igor.druzhinin@xxxxxxxxxx>
    Signed-off-by: George Dunlap <george.dunlap@xxxxxxxxxx>
    master commit: 71b8b46111219a2f83f4f9ae06ac5409744ea86e
    master date: 2016-10-11 14:23:52 +0100
---
 xen/common/trace.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/common/trace.c b/xen/common/trace.c
index f651cf3..2f4ecca 100644
--- a/xen/common/trace.c
+++ b/xen/common/trace.c
@@ -148,8 +148,12 @@ static int calculate_tbuf_size(unsigned int pages, 
uint16_t t_info_first_offset)
         pages = max_pages;
     }
 
-    t_info_words = num_online_cpus() * pages * sizeof(uint32_t);
-    t_info_pages = PFN_UP(t_info_first_offset + t_info_words);
+    /* 
+     * NB this calculation is correct, because t_info_first_offset is
+     * in words, not bytes, not bytes
+     */
+    t_info_words = num_online_cpus() * pages + t_info_first_offset;
+    t_info_pages = PFN_UP(t_info_words * sizeof(uint32_t));
     printk(XENLOG_INFO "xentrace: requesting %u t_info pages "
            "for %u trace pages on %u cpus\n",
            t_info_pages, pages, num_online_cpus());
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.6

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
https://lists.xenproject.org/xen-changelog

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.