Skip to content

Commit 9725471

Browse files
committed
libipt, block: when filling a new cache entry, also proceed with the cache to update block
Signed-off-by: Yida Zhang <[email protected]>
1 parent 60dc2df commit 9725471

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

libipt/src/pt_block_decoder.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
static int pt_blk_proceed_trailing_event(struct pt_block_decoder *,
4646
struct pt_block *);
4747

48+
static int pt_blk_proceed_no_event_cached(struct pt_block_decoder *decoder,
49+
struct pt_block *block,
50+
struct pt_block_cache *bcache,
51+
const struct pt_mapped_section *msec);
4852
static int pt_blk_set_trig_anchor(struct pt_block_decoder *decoder)
4953
{
5054
if (!decoder)
@@ -2249,6 +2253,7 @@ pt_blk_proceed_no_event_fill_cache(struct pt_block_decoder *decoder,
22492253
uint64_t nip, dip, ioff, noff;
22502254
int64_t disp;
22512255
int status;
2256+
int fill_block;
22522257

22532258
if (!decoder || !steps)
22542259
return -pte_internal;
@@ -2431,6 +2436,8 @@ pt_blk_proceed_no_event_fill_cache(struct pt_block_decoder *decoder,
24312436
if (status < 0)
24322437
return status;
24332438

2439+
2440+
fill_block = pt_bce_is_valid(bce);
24342441
/* If we don't have a valid cache entry, yet, fill the cache some more.
24352442
*
24362443
* On our way back, we add a cache entry for this instruction based on
@@ -2515,7 +2522,18 @@ pt_blk_proceed_no_event_fill_cache(struct pt_block_decoder *decoder,
25152522
* Cache updates are atomic so even if the two versions were not
25162523
* identical, we wouldn't care because they are both correct.
25172524
*/
2518-
return pt_bcache_add(bcache, ioff, bce);
2525+
status = pt_bcache_add(bcache, ioff, bce);
2526+
if (status < 0)
2527+
return status;
2528+
2529+
/* After we fill a new cache entry, we also need to update the block
2530+
* with that entry.
2531+
*/
2532+
if (fill_block)
2533+
return pt_blk_proceed_no_event_cached(decoder, block,
2534+
bcache, msec);
2535+
2536+
return status;
25192537
}
25202538

25212539
/* Proceed at a potentially truncated instruction.

0 commit comments

Comments
 (0)