diff mbox

[v7,25/24] symbols/xsplice: Implement fast symbol names -> virtual addresses lookup

Message ID 20160413021710.GA31947@localhost.localdomain (mailing list archive)
State New, archived
Headers show

Commit Message

Konrad Rzeszutek Wilk April 13, 2016, 2:17 a.m. UTC
On Tue, Apr 12, 2016 at 10:03:12PM -0400, Konrad Rzeszutek Wilk wrote:
> On Tue, Apr 12, 2016 at 04:59:02PM -0400, Konrad Rzeszutek Wilk wrote:
> > The current mechanism is geared towards fast virtual address ->
> > symbol names lookup. This is fine for the normal use cases
> > (BUG_ON, WARN_ON, etc), but for xSplice - where we need to find
> > hypervisor symbols - it is slow.
> .. snip..
> > NEW CODE:
> > Searching for symbols is simplified as we can do a binary search
> > on symbol_names_sorted (and using symbols_markers_sorted). Since the
> > symbols are sorted it takes on average 13 calls to symbols_expand_symbol.
> 
> And there is a bug somewhere. The virtual address that was tied to
> 'printk' actually ended up being tied to 'printed.21561'!
> 
> As such, when reviewing this code be aware there is something I must have missed!

<blushes>


Fixes it.
diff mbox

Patch

diff --git a/xen/common/symbols.c b/xen/common/symbols.c
index cfea93e..3d7e5b2 100644
--- a/xen/common/symbols.c
+++ b/xen/common/symbols.c
@@ -261,7 +261,7 @@  unsigned long symbols_lookup_by_name(const char *symname)
         else if ( rc > 0 )
             low = mid + 1;
         else
-            return symbols_address(symbols_addresses_index_sorted[low]);
+            return symbols_address(symbols_addresses_index_sorted[mid]);
     }
     return 0;
 }