|
45 | 45 | static int pt_blk_proceed_trailing_event(struct pt_block_decoder *,
|
46 | 46 | struct pt_block *);
|
47 | 47 |
|
| 48 | +static int pt_blk_proceed_no_event_cached(struct pt_block_decoder *, |
| 49 | + struct pt_block *, |
| 50 | + struct pt_block_cache *, |
| 51 | + const struct pt_mapped_section *); |
| 52 | + |
48 | 53 | static int pt_blk_set_trig_anchor(struct pt_block_decoder *decoder)
|
49 | 54 | {
|
50 | 55 | if (!decoder)
|
@@ -2249,6 +2254,7 @@ pt_blk_proceed_no_event_fill_cache(struct pt_block_decoder *decoder,
|
2249 | 2254 | uint64_t nip, dip, ioff, noff;
|
2250 | 2255 | int64_t disp;
|
2251 | 2256 | int status;
|
| 2257 | + int fill_cache; |
2252 | 2258 |
|
2253 | 2259 | if (!decoder || !steps)
|
2254 | 2260 | return -pte_internal;
|
@@ -2436,7 +2442,8 @@ pt_blk_proceed_no_event_fill_cache(struct pt_block_decoder *decoder,
|
2436 | 2442 | * On our way back, we add a cache entry for this instruction based on
|
2437 | 2443 | * the cache entry of the succeeding instruction.
|
2438 | 2444 | */
|
2439 |
| - if (!pt_bce_is_valid(bce)) { |
| 2445 | + fill_cache = !pt_bce_is_valid(bce); |
| 2446 | + if (fill_cache) { |
2440 | 2447 | /* If we exceeded the maximum number of allowed steps, we insert
|
2441 | 2448 | * a trampoline to the next instruction.
|
2442 | 2449 | *
|
@@ -2515,7 +2522,15 @@ pt_blk_proceed_no_event_fill_cache(struct pt_block_decoder *decoder,
|
2515 | 2522 | * Cache updates are atomic so even if the two versions were not
|
2516 | 2523 | * identical, we wouldn't care because they are both correct.
|
2517 | 2524 | */
|
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 | + /* Filling the cache may have extended @block, so we cannot proceed. */ |
| 2530 | + if (fill_cache) |
| 2531 | + return status; |
| 2532 | + |
| 2533 | + return pt_blk_proceed_no_event_cached(decoder, block, bcache, msec); |
2519 | 2534 | }
|
2520 | 2535 |
|
2521 | 2536 | /* Proceed at a potentially truncated instruction.
|
|
0 commit comments