aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hv/hv_balloon.c
diff options
context:
space:
mode:
authorK. Y. Srinivasan <kys@microsoft.com>2013-03-18 16:51:38 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-29 12:03:21 -0400
commit7f4f2302a11173d0ef84bbab4b887b9b50c31dc6 (patch)
treed5cd944948730df766a41bf54d96d8986866ba45 /drivers/hv/hv_balloon.c
parentf766dc1ea576fcdfbf2bc5638757ddbdacfb5a69 (diff)
Drivers: hv: Notify the host of permanent hot-add failures
If memory hot-add fails with the error -EEXIST, then this is a permanent failure. Notify the host of this information, so the host will not attempt hot-add again. If the failure were a transient failure, host will attempt a hot-add after some delay. In this version of the patch, I have added some additional comments to clarify how the host treats different failure conditions. Signed-off-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/hv/hv_balloon.c')
-rw-r--r--drivers/hv/hv_balloon.c33
1 files changed, 31 insertions, 2 deletions
diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c
index d1b4a4624d81..4c605c70ebf9 100644
--- a/drivers/hv/hv_balloon.c
+++ b/drivers/hv/hv_balloon.c
@@ -590,6 +590,16 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size,
590 590
591 if (ret) { 591 if (ret) {
592 pr_info("hot_add memory failed error is %d\n", ret); 592 pr_info("hot_add memory failed error is %d\n", ret);
593 if (ret == -EEXIST) {
594 /*
595 * This error indicates that the error
596 * is not a transient failure. This is the
597 * case where the guest's physical address map
598 * precludes hot adding memory. Stop all further
599 * memory hot-add.
600 */
601 do_hot_add = false;
602 }
593 has->ha_end_pfn -= HA_CHUNK; 603 has->ha_end_pfn -= HA_CHUNK;
594 has->covered_end_pfn -= processed_pfn; 604 has->covered_end_pfn -= processed_pfn;
595 break; 605 break;
@@ -849,11 +859,30 @@ static void hot_add_req(struct work_struct *dummy)
849 rg_sz = region_size; 859 rg_sz = region_size;
850 } 860 }
851 861
852 resp.page_count = process_hot_add(pg_start, pfn_cnt, 862 if (do_hot_add)
853 rg_start, rg_sz); 863 resp.page_count = process_hot_add(pg_start, pfn_cnt,
864 rg_start, rg_sz);
854#endif 865#endif
866 /*
867 * The result field of the response structure has the
868 * following semantics:
869 *
870 * 1. If all or some pages hot-added: Guest should return success.
871 *
872 * 2. If no pages could be hot-added:
873 *
874 * If the guest returns success, then the host
875 * will not attempt any further hot-add operations. This
876 * signifies a permanent failure.
877 *
878 * If the guest returns failure, then this failure will be
879 * treated as a transient failure and the host may retry the
880 * hot-add operation after some delay.
881 */
855 if (resp.page_count > 0) 882 if (resp.page_count > 0)
856 resp.result = 1; 883 resp.result = 1;
884 else if (!do_hot_add)
885 resp.result = 1;
857 else 886 else
858 resp.result = 0; 887 resp.result = 0;
859 888