47
47
48
48
MODULE_AUTHOR ("VMware, Inc." );
49
49
MODULE_DESCRIPTION ("VMware Memory Control (Balloon) Driver" );
50
- MODULE_VERSION ("1.4.0 .0-k" );
50
+ MODULE_VERSION ("1.4.1 .0-k" );
51
51
MODULE_ALIAS ("dmi:*:svnVMware*:*" );
52
52
MODULE_ALIAS ("vmware_vmmemctl" );
53
53
MODULE_LICENSE ("GPL" );
@@ -564,12 +564,14 @@ static void vmballoon_pop(struct vmballoon *b)
564
564
}
565
565
}
566
566
567
- if ((b -> capabilities & VMW_BALLOON_BATCHED_CMDS ) != 0 ) {
568
- if (b -> batch_page )
569
- vunmap (b -> batch_page );
567
+ if (b -> batch_page ) {
568
+ vunmap (b -> batch_page );
569
+ b -> batch_page = NULL ;
570
+ }
570
571
571
- if (b -> page )
572
- __free_page (b -> page );
572
+ if (b -> page ) {
573
+ __free_page (b -> page );
574
+ b -> page = NULL ;
573
575
}
574
576
}
575
577
@@ -1044,7 +1046,7 @@ static void vmballoon_work(struct work_struct *work)
1044
1046
if (b -> slow_allocation_cycles > 0 )
1045
1047
b -> slow_allocation_cycles -- ;
1046
1048
1047
- if (vmballoon_send_get_target (b , & target )) {
1049
+ if (! b -> reset_required && vmballoon_send_get_target (b , & target )) {
1048
1050
/* update target, adjust size */
1049
1051
b -> target = target ;
1050
1052
@@ -1076,8 +1078,10 @@ static int vmballoon_debug_show(struct seq_file *f, void *offset)
1076
1078
/* format capabilities info */
1077
1079
seq_printf (f ,
1078
1080
"balloon capabilities: %#4x\n"
1079
- "used capabilities: %#4lx\n" ,
1080
- VMW_BALLOON_CAPABILITIES , b -> capabilities );
1081
+ "used capabilities: %#4lx\n"
1082
+ "is resetting: %c\n" ,
1083
+ VMW_BALLOON_CAPABILITIES , b -> capabilities ,
1084
+ b -> reset_required ? 'y' : 'n' );
1081
1085
1082
1086
/* format size info */
1083
1087
seq_printf (f ,
@@ -1196,35 +1200,14 @@ static int __init vmballoon_init(void)
1196
1200
1197
1201
INIT_DELAYED_WORK (& balloon .dwork , vmballoon_work );
1198
1202
1199
- /*
1200
- * Start balloon.
1201
- */
1202
- if (!vmballoon_send_start (& balloon , VMW_BALLOON_CAPABILITIES )) {
1203
- pr_err ("failed to send start command to the host\n" );
1204
- return - EIO ;
1205
- }
1206
-
1207
- if ((balloon .capabilities & VMW_BALLOON_BATCHED_CMDS ) != 0 ) {
1208
- balloon .ops = & vmballoon_batched_ops ;
1209
- balloon .batch_max_pages = VMW_BALLOON_BATCH_MAX_PAGES ;
1210
- if (!vmballoon_init_batching (& balloon )) {
1211
- pr_err ("failed to init batching\n" );
1212
- return - EIO ;
1213
- }
1214
- } else if ((balloon .capabilities & VMW_BALLOON_BASIC_CMDS ) != 0 ) {
1215
- balloon .ops = & vmballoon_basic_ops ;
1216
- balloon .batch_max_pages = 1 ;
1217
- }
1218
-
1219
- if (!vmballoon_send_guest_id (& balloon )) {
1220
- pr_err ("failed to send guest ID to the host\n" );
1221
- return - EIO ;
1222
- }
1223
-
1224
1203
error = vmballoon_debugfs_init (& balloon );
1225
1204
if (error )
1226
1205
return error ;
1227
1206
1207
+ balloon .batch_page = NULL ;
1208
+ balloon .page = NULL ;
1209
+ balloon .reset_required = true;
1210
+
1228
1211
queue_delayed_work (system_freezable_wq , & balloon .dwork , 0 );
1229
1212
1230
1213
return 0 ;
@@ -1242,7 +1225,7 @@ static void __exit vmballoon_exit(void)
1242
1225
* Reset connection before deallocating memory to avoid potential for
1243
1226
* additional spurious resets from guest touching deallocated pages.
1244
1227
*/
1245
- vmballoon_send_start (& balloon , VMW_BALLOON_CAPABILITIES );
1228
+ vmballoon_send_start (& balloon , 0 );
1246
1229
vmballoon_pop (& balloon );
1247
1230
}
1248
1231
module_exit (vmballoon_exit );
0 commit comments