-
Notifications
You must be signed in to change notification settings - Fork 152
Update block along with the block cache #115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,6 +45,10 @@ | |
static int pt_blk_proceed_trailing_event(struct pt_block_decoder *, | ||
struct pt_block *); | ||
|
||
static int pt_blk_proceed_no_event_cached(struct pt_block_decoder *decoder, | ||
struct pt_block *block, | ||
struct pt_block_cache *bcache, | ||
const struct pt_mapped_section *msec); | ||
static int pt_blk_set_trig_anchor(struct pt_block_decoder *decoder) | ||
{ | ||
if (!decoder) | ||
|
@@ -2431,12 +2435,14 @@ pt_blk_proceed_no_event_fill_cache(struct pt_block_decoder *decoder, | |
if (status < 0) | ||
return status; | ||
|
||
|
||
int valid_cache = pt_bce_is_valid(bce); | ||
/* If we don't have a valid cache entry, yet, fill the cache some more. | ||
* | ||
* On our way back, we add a cache entry for this instruction based on | ||
* the cache entry of the succeeding instruction. | ||
*/ | ||
if (!pt_bce_is_valid(bce)) { | ||
if (!valid_cache) { | ||
/* If we exceeded the maximum number of allowed steps, we insert | ||
* a trampoline to the next instruction. | ||
* | ||
|
@@ -2515,7 +2521,14 @@ pt_blk_proceed_no_event_fill_cache(struct pt_block_decoder *decoder, | |
* Cache updates are atomic so even if the two versions were not | ||
* identical, we wouldn't care because they are both correct. | ||
*/ | ||
return pt_bcache_add(bcache, ioff, bce); | ||
status = pt_bcache_add(bcache, ioff, bce); | ||
if (status < 0) | ||
return status; | ||
|
||
if (valid_cache) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'd need some comment explaining that we can only proceed with the new cache entry if we have not filled the block. |
||
return pt_blk_proceed_no_event_cached(decoder, block, | ||
bcache, msec); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please indent until the opening parenthesis using tabs (tab width 8) as far as possible, then switching to spaces. Let's also add an empty line between the two returns. |
||
return status; | ||
} | ||
|
||
/* Proceed at a potentially truncated instruction. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please declare variables at the beginning of the function. We also need to find a better name, because valid_cache refers to an older cache entry that might have been updated when we use the variable. E.g. keep_filling, or just fill.