diff options
| -rw-r--r-- | kernel/events/hw_breakpoint.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/kernel/events/hw_breakpoint.c b/kernel/events/hw_breakpoint.c index 3f8cb1e14588..253ae2da13c3 100644 --- a/kernel/events/hw_breakpoint.c +++ b/kernel/events/hw_breakpoint.c | |||
| @@ -427,16 +427,9 @@ EXPORT_SYMBOL_GPL(register_user_hw_breakpoint); | |||
| 427 | * modify_user_hw_breakpoint - modify a user-space hardware breakpoint | 427 | * modify_user_hw_breakpoint - modify a user-space hardware breakpoint |
| 428 | * @bp: the breakpoint structure to modify | 428 | * @bp: the breakpoint structure to modify |
| 429 | * @attr: new breakpoint attributes | 429 | * @attr: new breakpoint attributes |
| 430 | * @triggered: callback to trigger when we hit the breakpoint | ||
| 431 | * @tsk: pointer to 'task_struct' of the process to which the address belongs | ||
| 432 | */ | 430 | */ |
| 433 | int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr) | 431 | int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr) |
| 434 | { | 432 | { |
| 435 | u64 old_addr = bp->attr.bp_addr; | ||
| 436 | u64 old_len = bp->attr.bp_len; | ||
| 437 | int old_type = bp->attr.bp_type; | ||
| 438 | int err = 0; | ||
| 439 | |||
| 440 | /* | 433 | /* |
| 441 | * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it | 434 | * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it |
| 442 | * will not be possible to raise IPIs that invoke __perf_event_disable. | 435 | * will not be possible to raise IPIs that invoke __perf_event_disable. |
| @@ -451,27 +444,18 @@ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *att | |||
| 451 | bp->attr.bp_addr = attr->bp_addr; | 444 | bp->attr.bp_addr = attr->bp_addr; |
| 452 | bp->attr.bp_type = attr->bp_type; | 445 | bp->attr.bp_type = attr->bp_type; |
| 453 | bp->attr.bp_len = attr->bp_len; | 446 | bp->attr.bp_len = attr->bp_len; |
| 447 | bp->attr.disabled = 1; | ||
| 454 | 448 | ||
| 455 | if (attr->disabled) | 449 | if (!attr->disabled) { |
| 456 | goto end; | 450 | int err = validate_hw_breakpoint(bp); |
| 457 | |||
| 458 | err = validate_hw_breakpoint(bp); | ||
| 459 | if (!err) | ||
| 460 | perf_event_enable(bp); | ||
| 461 | 451 | ||
| 462 | if (err) { | 452 | if (err) |
| 463 | bp->attr.bp_addr = old_addr; | 453 | return err; |
| 464 | bp->attr.bp_type = old_type; | ||
| 465 | bp->attr.bp_len = old_len; | ||
| 466 | if (!bp->attr.disabled) | ||
| 467 | perf_event_enable(bp); | ||
| 468 | 454 | ||
| 469 | return err; | 455 | perf_event_enable(bp); |
| 456 | bp->attr.disabled = 0; | ||
| 470 | } | 457 | } |
| 471 | 458 | ||
| 472 | end: | ||
| 473 | bp->attr.disabled = attr->disabled; | ||
| 474 | |||
| 475 | return 0; | 459 | return 0; |
| 476 | } | 460 | } |
| 477 | EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint); | 461 | EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint); |
