diff options
-rw-r--r-- | drivers/hv/hv_balloon.c | 33 |
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 | ||