libipt, block: cache the current section
The block decoder needs to find and map the section containing the block's start
IP in the current address-space on every call to pt_blk_next(). The image
maintains an LRU cache so finding the desired section is typically fast.
The operation still requires one additional pt_section_get() and one additional
pt_section_map() to ensure that the section is not unmapped or destroyed while
the block decoder uses it. Plus the corresponding pt_section_unmap() and
pt_section_put() at the end of pt_blk_next().
Cache the current section across pt_blk_next() calls to avoid this overhead.
We validate that a pt_image_find() would return the cached section before using
it. This check is much cheaper, though, as it does not require any additional
get/put or map/unmap.
Change-Id: I50ee5e549db0b2ad816c4b5825ae6802503e8bf8
Signed-off-by: Markus Metzger <markus.t.metzger@intel.com>
2 files changed