Skip to content

Commit

Permalink
qmp-event: add event notification for memory hot unplug error
Browse files Browse the repository at this point in the history
When memory hot unplug fails, this patch adds support to send
QMP event to notify mgmt about this failure.

Reviewed-by: Igor Mammedov <[email protected]>
Signed-off-by: Zhu Guihua <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
  • Loading branch information
Zhu Guihua authored and mstsirkin committed Apr 27, 2015
1 parent c06b2ff commit bc09e06
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
17 changes: 17 additions & 0 deletions docs/qmp/qmp-events.txt
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,23 @@ Example:
{ "event": "GUEST_PANICKED",
"data": { "action": "pause" } }

MEM_HOT_UNPLUG_ERROR
--------------------
Emitted when memory hot unplug error occurs.

Data:

- "device": device name (json-string)
- "msg": Informative message (e.g., reason for the error) (json-string)

Example:

{ "event": "MEM_HOT_UNPLUG_ERROR"
"data": { "device": "dimm1",
"msg": "acpi: device unplug for unsupported device"
},
"timestamp": { "seconds": 1265044230, "microseconds": 450486 } }

NIC_RX_FILTER_CHANGED
---------------------

Expand Down
10 changes: 9 additions & 1 deletion hw/acpi/memory_hotplug.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data,
ACPIOSTInfo *info;
DeviceState *dev = NULL;
HotplugHandler *hotplug_ctrl = NULL;
Error *local_err = NULL;

if (!mem_st->dev_count) {
return;
Expand Down Expand Up @@ -148,7 +149,14 @@ static void acpi_memory_hotplug_write(void *opaque, hwaddr addr, uint64_t data,
dev = DEVICE(mdev->dimm);
hotplug_ctrl = qdev_get_hotplug_handler(dev);
/* call pc-dimm unplug cb */
hotplug_handler_unplug(hotplug_ctrl, dev, NULL);
hotplug_handler_unplug(hotplug_ctrl, dev, &local_err);
if (local_err) {
trace_mhp_acpi_pc_dimm_delete_failed(mem_st->selector);
qapi_event_send_mem_unplug_error(dev->id,
error_get_pretty(local_err),
&error_abort);
break;
}
trace_mhp_acpi_pc_dimm_deleted(mem_st->selector);
}
break;
Expand Down
14 changes: 14 additions & 0 deletions qapi/event.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,3 +330,17 @@
##
{ 'event': 'VSERPORT_CHANGE',
'data': { 'id': 'str', 'open': 'bool' } }

##
# @MEM_UNPLUG_ERROR
#
# Emitted when memory hot unplug error occurs.
#
# @device: device name
#
# @msg: Informative message
#
# Since: 2.4
##
{ 'event': 'MEM_UNPLUG_ERROR',
'data': { 'device': 'str', 'msg': 'str' } }
1 change: 1 addition & 0 deletions trace-events
Original file line number Diff line number Diff line change
Expand Up @@ -1575,6 +1575,7 @@ mhp_acpi_write_ost_status(uint32_t slot, uint32_t st) "slot[0x%"PRIx32"] OST STA
mhp_acpi_clear_insert_evt(uint32_t slot) "slot[0x%"PRIx32"] clear insert event"
mhp_acpi_clear_remove_evt(uint32_t slot) "slot[0x%"PRIx32"] clear remove event"
mhp_acpi_pc_dimm_deleted(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm deleted"
mhp_acpi_pc_dimm_delete_failed(uint32_t slot) "slot[0x%"PRIx32"] pc-dimm delete failed"

# hw/i386/pc.c
mhp_pc_dimm_assigned_slot(int slot) "0x%d"
Expand Down

0 comments on commit bc09e06

Please sign in to comment.