summary refs log tree commit diff stats
path: root/results/scraper/launchpad/1769053
blob: 3c7e24b8bf52e254f396ba246f9e151647b838ed (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
Ability to control phys-bits through libvirt

Attempting to start a KVM guest with more than 1TB of RAM fails.

It looks like we might need some extra patches: https://lists.gnu.org/archive/html/qemu-discuss/2017-12/msg00005.html

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: qemu-system-x86 1:2.11+dfsg-1ubuntu7
ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
Uname: Linux 4.15.0-20-generic x86_64
ApportVersion: 2.20.9-0ubuntu7
Architecture: amd64
CurrentDesktop: Unity:Unity7:ubuntu
Date: Fri May  4 16:21:14 2018
InstallationDate: Installed on 2017-04-05 (393 days ago)
InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
MachineType: Dell Inc. XPS 13 9360
ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-20-generic root=/dev/mapper/ubuntu--vg-root ro quiet splash transparent_hugepage=madvise vt.handoff=1
SourcePackage: qemu
UpgradeStatus: Upgraded to bionic on 2018-04-30 (3 days ago)
dmi.bios.date: 02/26/2018
dmi.bios.vendor: Dell Inc.
dmi.bios.version: 2.6.2
dmi.board.name: 0PF86Y
dmi.board.vendor: Dell Inc.
dmi.board.version: A00
dmi.chassis.type: 9
dmi.chassis.vendor: Dell Inc.
dmi.modalias: dmi:bvnDellInc.:bvr2.6.2:bd02/26/2018:svnDellInc.:pnXPS139360:pvr:rvnDellInc.:rn0PF86Y:rvrA00:cvnDellInc.:ct9:cvr:
dmi.product.family: XPS
dmi.product.name: XPS 13 9360
dmi.sys.vendor: Dell Inc.



(I'm not trying to start this on my laptop, so ignore the uploaded files. They're just what apport-bug decided to include.)

Hi Daniel,
might I ask what you expect now?

The changes to seabios are not even upstream yet in git://git.seabios.org/seabios.git
The changes to qemu are neither upstream in git://git.qemu.org/qemu.git

The changes linked also are for a qemu way++ back in time (like pre trusty), so they just don't apply. Some of these changes are handled already, but different like the second qemu change of above mail is in qemu since "6c7c3c21 x86: implement la57 paging mode" which is qemu >=2.9.
That said - this one I could track, maybe the other changes are also upstream but in a way different form.

At least for myself I currently have no >1TB system to even try this - well I have done this on s390x and there it works fine already but you need x86 here.

Even when all of the above would be resolved, the mail above states that even if those are applied they still have issues when going >1TB.

I think you'd need a clear this is what I tried and this is what fails with a setup as simple as possible. If it fails in Ubuntu we can build a latest upstream build for you and if failing there we can work with upstream to resolve properly. From there we can think about the backportability of those changes. But the suggested "hey there are these patches, won't work.

Please don't get me wrong (I want to help), but so far this appears to me so far as a suggestion of a set of non-upstreamed, non-applicable, non-testable, non-working changes.
We need to better sort out how to handle this which is why I ask what you expect to happen now.

Hi Christian,

Sorry, I should have been a *lot* more clear.

I wanted to file the bug so that we have somewhere to figure out what needs
to be done and track the progress - trying to avoid it becoming something
we vaguely know about but don't ever do anything about.

Thanks so much for your analysis of the patches. I will dig in to the
upstream status and see where they're at with large memory guests.

I know we're missing test hardware. I will make some enquiries within the
team and see what can dig up, otherwise we have a customer that might be
able to run some tests.

So for now, the action items are:
 - I will hunt down a >1TB machine.
 - I will check what the progress of 1TB guests in upstream Qemu is.

Apologies again, and thanks for the pointers.

Regards,
Daniel

On Fri, May 4, 2018 at 5:44 PM, ChristianEhrhardt <
<email address hidden>> wrote:

> Hi Daniel,
> might I ask what you expect now?
>
> The changes to seabios are not even upstream yet in git://
> git.seabios.org/seabios.git
> The changes to qemu are neither upstream in git://git.qemu.org/qemu.git
>
> The changes linked also are for a qemu way++ back in time (like pre
> trusty), so they just don't apply. Some of these changes are handled
> already, but different like the second qemu change of above mail is in qemu
> since "6c7c3c21 x86: implement la57 paging mode" which is qemu >=2.9.
> That said - this one I could track, maybe the other changes are also
> upstream but in a way different form.
>
> At least for myself I currently have no >1TB system to even try this -
> well I have done this on s390x and there it works fine already but you
> need x86 here.
>
> Even when all of the above would be resolved, the mail above states that
> even if those are applied they still have issues when going >1TB.
>
> I think you'd need a clear this is what I tried and this is what fails
> with a setup as simple as possible. If it fails in Ubuntu we can build a
> latest upstream build for you and if failing there we can work with
> upstream to resolve properly. From there we can think about the
> backportability of those changes. But the suggested "hey there are these
> patches, won't work.
>
> Please don't get me wrong (I want to help), but so far this appears to me
> so far as a suggestion of a set of non-upstreamed, non-applicable,
> non-testable, non-working changes.
> We need to better sort out how to handle this which is why I ask what you
> expect to happen now.
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1769053
>
> Title:
>   Cannot start a guest with more than 1TB of RAM
>
> Status in QEMU:
>   New
> Status in qemu package in Ubuntu:
>   New
>
> Bug description:
>   Attempting to start a KVM guest with more than 1TB of RAM fails.
>
>   It looks like we might need some extra patches:
>   https://lists.gnu.org/archive/html/qemu-discuss/2017-12/msg00005.html
>
>   ProblemType: Bug
>   DistroRelease: Ubuntu 18.04
>   Package: qemu-system-x86 1:2.11+dfsg-1ubuntu7
>   ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
>   Uname: Linux 4.15.0-20-generic x86_64
>   ApportVersion: 2.20.9-0ubuntu7
>   Architecture: amd64
>   CurrentDesktop: Unity:Unity7:ubuntu
>   Date: Fri May  4 16:21:14 2018
>   InstallationDate: Installed on 2017-04-05 (393 days ago)
>   InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64
> (20161012.2)
>   MachineType: Dell Inc. XPS 13 9360
>   ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-20-generic
> root=/dev/mapper/ubuntu--vg-root ro quiet splash
> transparent_hugepage=madvise vt.handoff=1
>   SourcePackage: qemu
>   UpgradeStatus: Upgraded to bionic on 2018-04-30 (3 days ago)
>   dmi.bios.date: 02/26/2018
>   dmi.bios.vendor: Dell Inc.
>   dmi.bios.version: 2.6.2
>   dmi.board.name: 0PF86Y
>   dmi.board.vendor: Dell Inc.
>   dmi.board.version: A00
>   dmi.chassis.type: 9
>   dmi.chassis.vendor: Dell Inc.
>   dmi.modalias: dmi:bvnDellInc.:bvr2.6.2:bd02/26/2018:svnDellInc.:
> pnXPS139360:pvr:rvnDellInc.:rn0PF86Y:rvrA00:cvnDellInc.:ct9:cvr:
>   dmi.product.family: XPS
>   dmi.product.name: XPS 13 9360
>   dmi.sys.vendor: Dell Inc.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1769053/+subscriptions
>


Thanks for your clarification Daniel, I'll mark both tasks incomplete then until you come back with that data.

Interesting; I thought this was supposed to work.
I know we (RH) have some downstream patches for >1TB RAM, but the last I'd heard they weren't supposed to be necessary any more, except for compatibility with old versions.

It's probably worth checking the guest view fo the CPUs physical address bits and making sure it's no bigger than the host (phys-bits=n or host-phys-bits=true on the -cpu)
QEMU often defaults to 40 bits and things get confusing.

Note also you can do some 1TB+ tests on smaller machines as long as they have a large enough address size on the host CPUs.  Tricks like adding empty hot-plug DIMM slots leaving a 1TB hole can tickle some bugs.   Even adding 1TB of swap to your host and being careful with your guest can work :-)

You don't need a >1TB host to spin up a >1TB guest.  Unless you're using pci passthru (and/or SRIOV), or something else that requires qemu to alloc and pin all guest mem, you can simply overcommit; normal guests don't require mem pre-allocation or pinning.

On your host do this to allow overcommitting such a large amount (this allows 16T but can be adjusted as needed):

$ echo $[ 16 * 1024 * 1024 * 1024 ] | sudo tee /proc/sys/vm/overcommit_kbytes 
17179869184
$ echo 1 | sudo tee /proc/sys/vm/overcommit_memory 
1


Then just virsh edit your guest to use >1TB, e.g.:

  <memory unit='GiB'>1500</memory>


And of course, stop and restart the guest to pick up the xml change.

BTW this is the stacktrace I get from a Xenial guest on Xenial host:

[    0.000000] BUG: unable to handle kernel paging request at ffffc90000000004
[    0.000000] IP: [<ffffffff81f7dc60>] hpet_enable.part.13+0x23/0x2a5
[    0.000000] PGD 171629ab067 PUD 171629ac067 PMD 171629ad067 PTE 80000000fed00073
[    0.000000] Oops: 0009 [#1] SMP 
[    0.000000] Modules linked in:
[    0.000000] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.4.0-122-generic #146-Ubuntu
[    0.000000] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014
[    0.000000] task: ffffffff81e13500 ti: ffffffff81e00000 task.ti: ffffffff81e00000
[    0.000000] RIP: 0010:[<ffffffff81f7dc60>]  [<ffffffff81f7dc60>] hpet_enable.part.13+0x23/0x2a5
[    0.000000] RSP: 0000:ffffffff81e03ef0  EFLAGS: 00010282
[    0.000000] RAX: ffffc90000000000 RBX: ffffffffffffffff RCX: 0000000000000000
[    0.000000] RDX: 0000000000000000 RSI: 0000000000000100 RDI: 0000000000000000
[    0.000000] RBP: ffffffff81e03f10 R08: 000000000001ad50 R09: 00000000000001f0
[    0.000000] R10: ffff89773fa20000 R11: 0000000000000001 R12: ffff89773f99f6c0
[    0.000000] R13: ffffffff8200e920 R14: ffffffff8201c2e0 R15: ffffffff81e03fa8
[    0.000000] FS:  0000000000000000(0000) GS:ffff897162c00000(0000) knlGS:0000000000000000
[    0.000000] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[    0.000000] CR2: ffffc90000000004 CR3: 0000000001e0a000 CR4: 0000000000000630
[    0.000000] Stack:
[    0.000000]  ffffffffffffffff ffff89773f99f6c0 ffffffff8200e920 ffffffff8201c2e0
[    0.000000]  ffffffff81e03f20 ffffffff81f7df00 ffffffff81e03f30 ffffffff81f6ee7a
[    0.000000]  ffffffff81e03f40 ffffffff81f6ee4a ffffffff81e03f80 ffffffff81f63f71
[    0.000000] Call Trace:
[    0.000000]  [<ffffffff81f7df00>] hpet_enable+0x1e/0x20
[    0.000000]  [<ffffffff81f6ee7a>] hpet_time_init+0x9/0x19
[    0.000000]  [<ffffffff81f6ee4a>] x86_late_time_init+0x10/0x17
[    0.000000]  [<ffffffff81f63f71>] start_kernel+0x3d8/0x4aa
[    0.000000]  [<ffffffff81f63120>] ? early_idt_handler_array+0x120/0x120
[    0.000000]  [<ffffffff81f63339>] x86_64_start_reservations+0x2a/0x2c
[    0.000000]  [<ffffffff81f63485>] x86_64_start_kernel+0x14a/0x16d
[    0.000000] Code: 01 00 00 00 41 5c 5d c3 55 48 8b 3d 63 f4 18 00 be 00 04 00 00 48 89 e5 41 56 41 55 41 54 53 e8 f7 f2 0e ff 48 89 05 d8 f4 18 00 <8b> 48 04 b8 e9 03 00 00 48 8b 15 c9 f4 18 00 8b 52 10 ff c2 75 
[    0.000000] RIP  [<ffffffff81f7dc60>] hpet_enable.part.13+0x23/0x2a5
[    0.000000]  RSP <ffffffff81e03ef0>
[    0.000000] CR2: ffffc90000000004
[    0.000000] ---[ end trace 404be15fe05aa681 ]---
[    0.000000] Kernel panic - not syncing: Attempted to kill the idle task!
[    0.000000] ---[ end Kernel panic - not syncing: Attempted to kill the idle task!


And with non-massive mem (so the guest actually boots up), the guest does show only 40 bits of phys mem addressing, so qemu will definitely have to increase that to be able to provide >1TB of phys mem to the guest (assuming qemu doesn't adjust that dynamically based on the total mem provided to the guest)

ubuntu@largemem:~$ grep -m 1 'address sizes' /proc/cpuinfo 
address sizes	: 40 bits physical, 48 bits virtual


Ah right Dan, if you're seeing the 40 bits physical in the guest you definitely need to try the flags I suggest in comment 6; host-phys-bits=true  should work for you.

> Interesting; I thought this was supposed to work.

Exactly that was my thought when triaging it initially
Furthermore I assume people working la57 (https://lwn.net/Articles/730925/) and such ran tests on much bigger sizes.

> Ah right Dan, if you're seeing the 40 bits physical in the guest you definitely need to try the flags I suggest in comment 6; host-phys-bits=true should work for you.

I tested Bionic to be at least on libvirt 4.0 / qemu 2.11.1 when we want to check things under the "supposed to work now" flag.

Defaults:
Host:  address sizes   : 46 bits physical, 48 bits virtual
Guest: address sizes   : 40 bits physical, 48 bits virtual

I ensured that with option -cpu host,host-phys-bits=true set I successfully get what my host can provide in the guest:
Guest: address sizes   : 46 bits physical, 48 bits virtual

Starting a guest with that >1TB (that would be mostly on swap if needed) works just fine as expected. Here ~1063 GB from /proc/meminfo
MemTotal:       1114676492 kB

I also checked a more compatible approach like -cpu qemu64,phys-bits=42 and that works as well.

IMHO - if anything - one could argue that libvirt/qemu could be smarter about e.g. auto adding those arguments (or print a warning) when crossing a certain memory size.

So for now I'd stick to the "actually works" summary and keep the status to incomplete.

* ChristianEhrhardt (<email address hidden>) wrote:
> > Interesting; I thought this was supposed to work.
> 
> Exactly that was my thought when triaging it initially
> Furthermore I assume people working la57 (https://lwn.net/Articles/730925/) and such ran tests on much bigger sizes.

I assume so, but I've not looked at the detail of that.

> > Ah right Dan, if you're seeing the 40 bits physical in the guest you
> definitely need to try the flags I suggest in comment 6; host-phys-
> bits=true should work for you.
> 
> I tested Bionic to be at least on libvirt 4.0 / qemu 2.11.1 when we want
> to check things under the "supposed to work now" flag.
> 
> Defaults:
> Host:  address sizes   : 46 bits physical, 48 bits virtual
> Guest: address sizes   : 40 bits physical, 48 bits virtual
> 
> I ensured that with option -cpu host,host-phys-bits=true set I successfully get what my host can provide in the guest:
> Guest: address sizes   : 46 bits physical, 48 bits virtual
> 
> Starting a guest with that >1TB (that would be mostly on swap if needed) works just fine as expected. Here ~1063 GB from /proc/meminfo
> MemTotal:       1114676492 kB

OK, good - that suggests there's nothing missing.
We enable host-phys-bits=true by default I think (in our machine type?)

> I also checked a more compatible approach like -cpu qemu64,phys-bits=42
> and that works as well.
> 
> IMHO - if anything - one could argue that libvirt/qemu could be smarter
> about e.g. auto adding those arguments (or print a warning) when
> crossing a certain memory size.

The problem is there are a whole bunch of things that are hard to deal
with:
  a) Cheaper CPUs tend to have smaller phys-bits even in the same
generation; e.g. my laptop is still 36 bits, a lot are 39 bits.  I think
the same is true of the Xeon E3-.... family.   It makes it hard to know
what to pick when you're going to allow migration.

  b) Reasoning about the total address size range is difficult; you've
got to take into account PCI address space and hot plug space etc
to know where the upper edge is.

Dave

> So for now I'd stick to the "actually works" summary and keep the status
> to incomplete.
> 
> -- 
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1769053
> 
> Title:
>   Cannot start a guest with more than 1TB of RAM
> 
> Status in QEMU:
>   Incomplete
> Status in qemu package in Ubuntu:
>   Incomplete
> 
> Bug description:
>   Attempting to start a KVM guest with more than 1TB of RAM fails.
> 
>   It looks like we might need some extra patches:
>   https://lists.gnu.org/archive/html/qemu-discuss/2017-12/msg00005.html
> 
>   ProblemType: Bug
>   DistroRelease: Ubuntu 18.04
>   Package: qemu-system-x86 1:2.11+dfsg-1ubuntu7
>   ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
>   Uname: Linux 4.15.0-20-generic x86_64
>   ApportVersion: 2.20.9-0ubuntu7
>   Architecture: amd64
>   CurrentDesktop: Unity:Unity7:ubuntu
>   Date: Fri May  4 16:21:14 2018
>   InstallationDate: Installed on 2017-04-05 (393 days ago)
>   InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
>   MachineType: Dell Inc. XPS 13 9360
>   ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-20-generic root=/dev/mapper/ubuntu--vg-root ro quiet splash transparent_hugepage=madvise vt.handoff=1
>   SourcePackage: qemu
>   UpgradeStatus: Upgraded to bionic on 2018-04-30 (3 days ago)
>   dmi.bios.date: 02/26/2018
>   dmi.bios.vendor: Dell Inc.
>   dmi.bios.version: 2.6.2
>   dmi.board.name: 0PF86Y
>   dmi.board.vendor: Dell Inc.
>   dmi.board.version: A00
>   dmi.chassis.type: 9
>   dmi.chassis.vendor: Dell Inc.
>   dmi.modalias: dmi:bvnDellInc.:bvr2.6.2:bd02/26/2018:svnDellInc.:pnXPS139360:pvr:rvnDellInc.:rn0PF86Y:rvrA00:cvnDellInc.:ct9:cvr:
>   dmi.product.family: XPS
>   dmi.product.name: XPS 13 9360
>   dmi.sys.vendor: Dell Inc.
> 
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1769053/+subscriptions
--
Dr. David Alan Gilbert / <email address hidden> / Manchester, UK


On Tue, May 8, 2018 at 10:37 AM, Dr. David Alan Gilbert <<email address hidden>
> wrote:

> * ChristianEhrhardt (<email address hidden>) wrote:
> > > Interesting; I thought this was supposed to work.
> >
> > Exactly that was my thought when triaging it initially
> > Furthermore I assume people working la57 (https://lwn.net/Articles/
> 730925/) and such ran tests on much bigger sizes.
>
> I assume so, but I've not looked at the detail of that.
>
> > > Ah right Dan, if you're seeing the 40 bits physical in the guest you
> > definitely need to try the flags I suggest in comment 6; host-phys-
> > bits=true should work for you.
> >
> > I tested Bionic to be at least on libvirt 4.0 / qemu 2.11.1 when we want
> > to check things under the "supposed to work now" flag.
> >
> > Defaults:
> > Host:  address sizes   : 46 bits physical, 48 bits virtual
> > Guest: address sizes   : 40 bits physical, 48 bits virtual
> >
> > I ensured that with option -cpu host,host-phys-bits=true set I
> successfully get what my host can provide in the guest:
> > Guest: address sizes   : 46 bits physical, 48 bits virtual
> >
> > Starting a guest with that >1TB (that would be mostly on swap if needed)
> works just fine as expected. Here ~1063 GB from /proc/meminfo
> > MemTotal:       1114676492 kB
>
> OK, good - that suggests there's nothing missing.
> We enable host-phys-bits=true by default I think (in our machine type?)
>

Interesting approach, I see your comment about that already in [1] when it
was added.
I didn't realize some machine types were setting this already - I assume it
isn't the general default for migratebility to other hosts (like our 36/39
bit laptops).

I assume "we" in this context are RedHat downstream changes to the (some)
machine type(s)?
I see the benefit for huge guests to work without setting those properties,
but I wonder if that caused you trouble in regard to migrations?

[1]: https://patchwork.kernel.org/patch/9223999/



> > I also checked a more compatible approach like -cpu qemu64,phys-bits=42
> > and that works as well.
> >
> > IMHO - if anything - one could argue that libvirt/qemu could be smarter
> > about e.g. auto adding those arguments (or print a warning) when
> > crossing a certain memory size.
>
> The problem is there are a whole bunch of things that are hard to deal
> with:
>   a) Cheaper CPUs tend to have smaller phys-bits even in the same
> generation; e.g. my laptop is still 36 bits, a lot are 39 bits.  I think
> the same is true of the Xeon E3-.... family.   It makes it hard to know
> what to pick when you're going to allow migration.
>
>   b) Reasoning about the total address size range is difficult; you've
> got to take into account PCI address space and hot plug space etc
> to know where the upper edge is.
>

I agree that checking the total address size might have too much false
positives for all the complexities around "estimating" that size.
/me is giving up this idea :-)


> Dave
>
> > So for now I'd stick to the "actually works" summary and keep the status
> > to incomplete.
> >
> > --
> > You received this bug notification because you are subscribed to the bug
> > report.
> > https://bugs.launchpad.net/bugs/1769053
> >
> > Title:
> >   Cannot start a guest with more than 1TB of RAM
> >
> > Status in QEMU:
> >   Incomplete
> > Status in qemu package in Ubuntu:
> >   Incomplete
> >
> > Bug description:
> >   Attempting to start a KVM guest with more than 1TB of RAM fails.
> >
> >   It looks like we might need some extra patches:
> >   https://lists.gnu.org/archive/html/qemu-discuss/2017-12/msg00005.html
> >
> >   ProblemType: Bug
> >   DistroRelease: Ubuntu 18.04
> >   Package: qemu-system-x86 1:2.11+dfsg-1ubuntu7
> >   ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
> >   Uname: Linux 4.15.0-20-generic x86_64
> >   ApportVersion: 2.20.9-0ubuntu7
> >   Architecture: amd64
> >   CurrentDesktop: Unity:Unity7:ubuntu
> >   Date: Fri May  4 16:21:14 2018
> >   InstallationDate: Installed on 2017-04-05 (393 days ago)
> >   InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64
> (20161012.2)
> >   MachineType: Dell Inc. XPS 13 9360
> >   ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-20-generic
> root=/dev/mapper/ubuntu--vg-root ro quiet splash
> transparent_hugepage=madvise vt.handoff=1
> >   SourcePackage: qemu
> >   UpgradeStatus: Upgraded to bionic on 2018-04-30 (3 days ago)
> >   dmi.bios.date: 02/26/2018
> >   dmi.bios.vendor: Dell Inc.
> >   dmi.bios.version: 2.6.2
> >   dmi.board.name: 0PF86Y
> >   dmi.board.vendor: Dell Inc.
> >   dmi.board.version: A00
> >   dmi.chassis.type: 9
> >   dmi.chassis.vendor: Dell Inc.
> >   dmi.modalias: dmi:bvnDellInc.:bvr2.6.2:bd02/26/2018:svnDellInc.:
> pnXPS139360:pvr:rvnDellInc.:rn0PF86Y:rvrA00:cvnDellInc.:ct9:cvr:
> >   dmi.product.family: XPS
> >   dmi.product.name: XPS 13 9360
> >   dmi.sys.vendor: Dell Inc.
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/qemu/+bug/1769053/+subscriptions
> --
> Dr. David Alan Gilbert / <email address hidden> / Manchester, UK
>
> --
> You received this bug notification because you are a member of Ubuntu
> Virtualisation team, which is subscribed to qemu in Ubuntu.
> https://bugs.launchpad.net/bugs/1769053
>
> Title:
>   Cannot start a guest with more than 1TB of RAM
>
> Status in QEMU:
>   Incomplete
> Status in qemu package in Ubuntu:
>   Incomplete
>
> Bug description:
>   Attempting to start a KVM guest with more than 1TB of RAM fails.
>
>   It looks like we might need some extra patches:
>   https://lists.gnu.org/archive/html/qemu-discuss/2017-12/msg00005.html
>
>   ProblemType: Bug
>   DistroRelease: Ubuntu 18.04
>   Package: qemu-system-x86 1:2.11+dfsg-1ubuntu7
>   ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
>   Uname: Linux 4.15.0-20-generic x86_64
>   ApportVersion: 2.20.9-0ubuntu7
>   Architecture: amd64
>   CurrentDesktop: Unity:Unity7:ubuntu
>   Date: Fri May  4 16:21:14 2018
>   InstallationDate: Installed on 2017-04-05 (393 days ago)
>   InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64
> (20161012.2)
>   MachineType: Dell Inc. XPS 13 9360
>   ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-20-generic
> root=/dev/mapper/ubuntu--vg-root ro quiet splash
> transparent_hugepage=madvise vt.handoff=1
>   SourcePackage: qemu
>   UpgradeStatus: Upgraded to bionic on 2018-04-30 (3 days ago)
>   dmi.bios.date: 02/26/2018
>   dmi.bios.vendor: Dell Inc.
>   dmi.bios.version: 2.6.2
>   dmi.board.name: 0PF86Y
>   dmi.board.vendor: Dell Inc.
>   dmi.board.version: A00
>   dmi.chassis.type: 9
>   dmi.chassis.vendor: Dell Inc.
>   dmi.modalias: dmi:bvnDellInc.:bvr2.6.2:bd02/26/2018:svnDellInc.:
> pnXPS139360:pvr:rvnDellInc.:rn0PF86Y:rvrA00:cvnDellInc.:ct9:cvr:
>   dmi.product.family: XPS
>   dmi.product.name: XPS 13 9360
>   dmi.sys.vendor: Dell Inc.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1769053/+subscriptions
>



-- 
Christian Ehrhardt
Software Engineer, Ubuntu Server
Canonical Ltd


* ChristianEhrhardt (<email address hidden>) wrote:
> On Tue, May 8, 2018 at 10:37 AM, Dr. David Alan Gilbert <<email address hidden>
> > wrote:
> 
> > * ChristianEhrhardt (<email address hidden>) wrote:
> > > > Interesting; I thought this was supposed to work.
> > >
> > > Exactly that was my thought when triaging it initially
> > > Furthermore I assume people working la57 (https://lwn.net/Articles/
> > 730925/) and such ran tests on much bigger sizes.
> >
> > I assume so, but I've not looked at the detail of that.
> >
> > > > Ah right Dan, if you're seeing the 40 bits physical in the guest you
> > > definitely need to try the flags I suggest in comment 6; host-phys-
> > > bits=true should work for you.
> > >
> > > I tested Bionic to be at least on libvirt 4.0 / qemu 2.11.1 when we want
> > > to check things under the "supposed to work now" flag.
> > >
> > > Defaults:
> > > Host:  address sizes   : 46 bits physical, 48 bits virtual
> > > Guest: address sizes   : 40 bits physical, 48 bits virtual
> > >
> > > I ensured that with option -cpu host,host-phys-bits=true set I
> > successfully get what my host can provide in the guest:
> > > Guest: address sizes   : 46 bits physical, 48 bits virtual
> > >
> > > Starting a guest with that >1TB (that would be mostly on swap if needed)
> > works just fine as expected. Here ~1063 GB from /proc/meminfo
> > > MemTotal:       1114676492 kB
> >
> > OK, good - that suggests there's nothing missing.
> > We enable host-phys-bits=true by default I think (in our machine type?)
> >
> 
> Interesting approach, I see your comment about that already in [1] when it
> was added.
> I didn't realize some machine types were setting this already - I assume it
> isn't the general default for migratebility to other hosts (like our 36/39
> bit laptops).
> 
> I assume "we" in this context are RedHat downstream changes to the (some)
> machine type(s)?

That's right; you sohuld be able to find them if you dig around CentOS's
set.

> I see the benefit for huge guests to work without setting those properties,
> but I wonder if that caused you trouble in regard to migrations?

It could, although I don't remember any reports of people hitting it.
The problem is finding a better solution;  that's why I added both the
host-phys-bits and the ability to set phys-bits=   so that you can make
a smarter choice based on what hardware you actually have.  Who or what
should make that smarter choice hasn't really ever been answered.

> [1]: https://patchwork.kernel.org/patch/9223999/

Prior to that patch set, QEMU had always been a fixed 40 bits, so I
didn't change the default behaviour with that set; I just let you change
it by adding the flags.
(As I remember TCG was hard coded as 40 bits in some places so didn't
want to break that either).

Dave

> 
> 
> > > I also checked a more compatible approach like -cpu qemu64,phys-bits=42
> > > and that works as well.
> > >
> > > IMHO - if anything - one could argue that libvirt/qemu could be smarter
> > > about e.g. auto adding those arguments (or print a warning) when
> > > crossing a certain memory size.
> >
> > The problem is there are a whole bunch of things that are hard to deal
> > with:
> >   a) Cheaper CPUs tend to have smaller phys-bits even in the same
> > generation; e.g. my laptop is still 36 bits, a lot are 39 bits.  I think
> > the same is true of the Xeon E3-.... family.   It makes it hard to know
> > what to pick when you're going to allow migration.
> >
> >   b) Reasoning about the total address size range is difficult; you've
> > got to take into account PCI address space and hot plug space etc
> > to know where the upper edge is.
> >
> 
> I agree that checking the total address size might have too much false
> positives for all the complexities around "estimating" that size.
> /me is giving up this idea :-)
> 
> 
> > Dave
> >
> > > So for now I'd stick to the "actually works" summary and keep the status
> > > to incomplete.
> > >
> > > --
> > > You received this bug notification because you are subscribed to the bug
> > > report.
> > > https://bugs.launchpad.net/bugs/1769053
> > >
> > > Title:
> > >   Cannot start a guest with more than 1TB of RAM
> > >
> > > Status in QEMU:
> > >   Incomplete
> > > Status in qemu package in Ubuntu:
> > >   Incomplete
> > >
> > > Bug description:
> > >   Attempting to start a KVM guest with more than 1TB of RAM fails.
> > >
> > >   It looks like we might need some extra patches:
> > >   https://lists.gnu.org/archive/html/qemu-discuss/2017-12/msg00005.html
> > >
> > >   ProblemType: Bug
> > >   DistroRelease: Ubuntu 18.04
> > >   Package: qemu-system-x86 1:2.11+dfsg-1ubuntu7
> > >   ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
> > >   Uname: Linux 4.15.0-20-generic x86_64
> > >   ApportVersion: 2.20.9-0ubuntu7
> > >   Architecture: amd64
> > >   CurrentDesktop: Unity:Unity7:ubuntu
> > >   Date: Fri May  4 16:21:14 2018
> > >   InstallationDate: Installed on 2017-04-05 (393 days ago)
> > >   InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64
> > (20161012.2)
> > >   MachineType: Dell Inc. XPS 13 9360
> > >   ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-20-generic
> > root=/dev/mapper/ubuntu--vg-root ro quiet splash
> > transparent_hugepage=madvise vt.handoff=1
> > >   SourcePackage: qemu
> > >   UpgradeStatus: Upgraded to bionic on 2018-04-30 (3 days ago)
> > >   dmi.bios.date: 02/26/2018
> > >   dmi.bios.vendor: Dell Inc.
> > >   dmi.bios.version: 2.6.2
> > >   dmi.board.name: 0PF86Y
> > >   dmi.board.vendor: Dell Inc.
> > >   dmi.board.version: A00
> > >   dmi.chassis.type: 9
> > >   dmi.chassis.vendor: Dell Inc.
> > >   dmi.modalias: dmi:bvnDellInc.:bvr2.6.2:bd02/26/2018:svnDellInc.:
> > pnXPS139360:pvr:rvnDellInc.:rn0PF86Y:rvrA00:cvnDellInc.:ct9:cvr:
> > >   dmi.product.family: XPS
> > >   dmi.product.name: XPS 13 9360
> > >   dmi.sys.vendor: Dell Inc.
> > >
> > > To manage notifications about this bug go to:
> > > https://bugs.launchpad.net/qemu/+bug/1769053/+subscriptions
> > --
> > Dr. David Alan Gilbert / <email address hidden> / Manchester, UK
> >
> > --
> > You received this bug notification because you are a member of Ubuntu
> > Virtualisation team, which is subscribed to qemu in Ubuntu.
> > https://bugs.launchpad.net/bugs/1769053
> >
> > Title:
> >   Cannot start a guest with more than 1TB of RAM
> >
> > Status in QEMU:
> >   Incomplete
> > Status in qemu package in Ubuntu:
> >   Incomplete
> >
> > Bug description:
> >   Attempting to start a KVM guest with more than 1TB of RAM fails.
> >
> >   It looks like we might need some extra patches:
> >   https://lists.gnu.org/archive/html/qemu-discuss/2017-12/msg00005.html
> >
> >   ProblemType: Bug
> >   DistroRelease: Ubuntu 18.04
> >   Package: qemu-system-x86 1:2.11+dfsg-1ubuntu7
> >   ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
> >   Uname: Linux 4.15.0-20-generic x86_64
> >   ApportVersion: 2.20.9-0ubuntu7
> >   Architecture: amd64
> >   CurrentDesktop: Unity:Unity7:ubuntu
> >   Date: Fri May  4 16:21:14 2018
> >   InstallationDate: Installed on 2017-04-05 (393 days ago)
> >   InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64
> > (20161012.2)
> >   MachineType: Dell Inc. XPS 13 9360
> >   ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-20-generic
> > root=/dev/mapper/ubuntu--vg-root ro quiet splash
> > transparent_hugepage=madvise vt.handoff=1
> >   SourcePackage: qemu
> >   UpgradeStatus: Upgraded to bionic on 2018-04-30 (3 days ago)
> >   dmi.bios.date: 02/26/2018
> >   dmi.bios.vendor: Dell Inc.
> >   dmi.bios.version: 2.6.2
> >   dmi.board.name: 0PF86Y
> >   dmi.board.vendor: Dell Inc.
> >   dmi.board.version: A00
> >   dmi.chassis.type: 9
> >   dmi.chassis.vendor: Dell Inc.
> >   dmi.modalias: dmi:bvnDellInc.:bvr2.6.2:bd02/26/2018:svnDellInc.:
> > pnXPS139360:pvr:rvnDellInc.:rn0PF86Y:rvrA00:cvnDellInc.:ct9:cvr:
> >   dmi.product.family: XPS
> >   dmi.product.name: XPS 13 9360
> >   dmi.sys.vendor: Dell Inc.
> >
> > To manage notifications about this bug go to:
> > https://bugs.launchpad.net/qemu/+bug/1769053/+subscriptions
> >
> 
> 
> -- 
> Christian Ehrhardt
> Software Engineer, Ubuntu Server
> Canonical Ltd
> 
> -- 
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1769053
> 
> Title:
>   Cannot start a guest with more than 1TB of RAM
> 
> Status in QEMU:
>   Incomplete
> Status in qemu package in Ubuntu:
>   Incomplete
> 
> Bug description:
>   Attempting to start a KVM guest with more than 1TB of RAM fails.
> 
>   It looks like we might need some extra patches:
>   https://lists.gnu.org/archive/html/qemu-discuss/2017-12/msg00005.html
> 
>   ProblemType: Bug
>   DistroRelease: Ubuntu 18.04
>   Package: qemu-system-x86 1:2.11+dfsg-1ubuntu7
>   ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
>   Uname: Linux 4.15.0-20-generic x86_64
>   ApportVersion: 2.20.9-0ubuntu7
>   Architecture: amd64
>   CurrentDesktop: Unity:Unity7:ubuntu
>   Date: Fri May  4 16:21:14 2018
>   InstallationDate: Installed on 2017-04-05 (393 days ago)
>   InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
>   MachineType: Dell Inc. XPS 13 9360
>   ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-20-generic root=/dev/mapper/ubuntu--vg-root ro quiet splash transparent_hugepage=madvise vt.handoff=1
>   SourcePackage: qemu
>   UpgradeStatus: Upgraded to bionic on 2018-04-30 (3 days ago)
>   dmi.bios.date: 02/26/2018
>   dmi.bios.vendor: Dell Inc.
>   dmi.bios.version: 2.6.2
>   dmi.board.name: 0PF86Y
>   dmi.board.vendor: Dell Inc.
>   dmi.board.version: A00
>   dmi.chassis.type: 9
>   dmi.chassis.vendor: Dell Inc.
>   dmi.modalias: dmi:bvnDellInc.:bvr2.6.2:bd02/26/2018:svnDellInc.:pnXPS139360:pvr:rvnDellInc.:rn0PF86Y:rvrA00:cvnDellInc.:ct9:cvr:
>   dmi.product.family: XPS
>   dmi.product.name: XPS 13 9360
>   dmi.sys.vendor: Dell Inc.
> 
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1769053/+subscriptions
--
Dr. David Alan Gilbert / <email address hidden> / Manchester, UK


Hmm, if we know that QEMU guests will crash & burn when > 1 TB mem, when host-phys-bits/phys-bits are unset, then perhaps libvirt should do the right thing by default here. eg we can't use host-phys-bits=true due to migration compat issues, but if we see > 1TB mem, libvirt could reasonably set phys-bits=NNN for some suitable value of NNN.  We should expose this in the XML config for the CPU explicitly too.

* Daniel Berrange (<email address hidden>) wrote:
> Hmm, if we know that QEMU guests will crash & burn when > 1 TB mem, when
> host-phys-bits/phys-bits are unset, then perhaps libvirt should do the
> right thing by default here. eg we can't use host-phys-bits=true due to
> migration compat issues, but if we see > 1TB mem, libvirt could
> reasonably set phys-bits=NNN for some suitable value of NNN.  We should
> expose this in the XML config for the CPU explicitly too.

Yep:
  a) It should be possible to add a setting to the XML to specify the
     phys-bits
  b) It should be possible for libvirt to check the host it's on can
     satisfy that requirement
  c) libvirt can check that if RAM > 2^phys-bits it can complain

but

  d) For smaller amount of RAM it might still fail if
RAM+rounding+pci+hotplug space goes over the limit.
     Figuring that limit out is tricky (and I thought it
     might be BIOS/EFI dependent as well depending where they
     decide to put their PCI devices)

Dave

> -- 
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1769053
> 
> Title:
>   Cannot start a guest with more than 1TB of RAM
> 
> Status in QEMU:
>   Incomplete
> Status in qemu package in Ubuntu:
>   Incomplete
> 
> Bug description:
>   Attempting to start a KVM guest with more than 1TB of RAM fails.
> 
>   It looks like we might need some extra patches:
>   https://lists.gnu.org/archive/html/qemu-discuss/2017-12/msg00005.html
> 
>   ProblemType: Bug
>   DistroRelease: Ubuntu 18.04
>   Package: qemu-system-x86 1:2.11+dfsg-1ubuntu7
>   ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
>   Uname: Linux 4.15.0-20-generic x86_64
>   ApportVersion: 2.20.9-0ubuntu7
>   Architecture: amd64
>   CurrentDesktop: Unity:Unity7:ubuntu
>   Date: Fri May  4 16:21:14 2018
>   InstallationDate: Installed on 2017-04-05 (393 days ago)
>   InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
>   MachineType: Dell Inc. XPS 13 9360
>   ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-20-generic root=/dev/mapper/ubuntu--vg-root ro quiet splash transparent_hugepage=madvise vt.handoff=1
>   SourcePackage: qemu
>   UpgradeStatus: Upgraded to bionic on 2018-04-30 (3 days ago)
>   dmi.bios.date: 02/26/2018
>   dmi.bios.vendor: Dell Inc.
>   dmi.bios.version: 2.6.2
>   dmi.board.name: 0PF86Y
>   dmi.board.vendor: Dell Inc.
>   dmi.board.version: A00
>   dmi.chassis.type: 9
>   dmi.chassis.vendor: Dell Inc.
>   dmi.modalias: dmi:bvnDellInc.:bvr2.6.2:bd02/26/2018:svnDellInc.:pnXPS139360:pvr:rvnDellInc.:rn0PF86Y:rvrA00:cvnDellInc.:ct9:cvr:
>   dmi.product.family: XPS
>   dmi.product.name: XPS 13 9360
>   dmi.sys.vendor: Dell Inc.
> 
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1769053/+subscriptions
--
Dr. David Alan Gilbert / <email address hidden> / Manchester, UK


  Hi,

>   d) For smaller amount of RAM it might still fail if
> RAM+rounding+pci+hotplug space goes over the limit.
>      Figuring that limit out is tricky (and I thought it
>      might be BIOS/EFI dependent as well depending where they
>      decide to put their PCI devices)

Both seabios and ovmf try to not go too high in address space.  Reason
is exactly the phys-bits issue.  Using 40 here by default does not only
limit the memory to 1TB.  It also has the problem that the guest thinks
it has 1TB of address space but in reality it might be less.  Even
recent skylake machines have phys-bits=39 (512G) only, and trying to use
the physical address space above 512G in the guest just doesn't work
because the phys-bits=39 limit applies to EPT too.

So checking phys-bits in the firmware, for example to place pci bars as
high as possible in physical address space, is not going to work.

IIRC ovmf uses a 32G sized region with 32G alignment by default, which
will land below 64G (aka phys-bits=36 address space) unless the guest
has more than 30 (q35) or 31 (piix4) GB of memory.

seabios will not map pci bars above 4G unless it runs out of space below
4G.  If needed 64bit PCI bars will be placed right above ram, with
gigabyte alignment.

cheers,
  Gerd



* Gerd Hoffmann (<email address hidden>) wrote:
> Hi,
> 
> >   d) For smaller amount of RAM it might still fail if
> > RAM+rounding+pci+hotplug space goes over the limit.
> >      Figuring that limit out is tricky (and I thought it
> >      might be BIOS/EFI dependent as well depending where they
> >      decide to put their PCI devices)
> 
> Both seabios and ovmf try to not go too high in address space.  Reason
> is exactly the phys-bits issue.  Using 40 here by default does not only
> limit the memory to 1TB.  It also has the problem that the guest thinks
> it has 1TB of address space but in reality it might be less.  Even
> recent skylake machines have phys-bits=39 (512G) only, and trying to use
> the physical address space above 512G in the guest just doesn't work
> because the phys-bits=39 limit applies to EPT too.
> 
> So checking phys-bits in the firmware, for example to place pci bars as
> high as possible in physical address space, is not going to work.
> 
> IIRC ovmf uses a 32G sized region with 32G alignment by default, which
> will land below 64G (aka phys-bits=36 address space) unless the guest
> has more than 30 (q35) or 31 (piix4) GB of memory.
> 
> seabios will not map pci bars above 4G unless it runs out of space below
> 4G.  If needed 64bit PCI bars will be placed right above ram, with
> gigabyte alignment.

Yep, I was tempted to set host-phys-bits=true on upstream, but TCG
has a fixed 40 bits last time I looked.

Dave

> cheers,
>   Gerd
> 
> -- 
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1769053
> 
> Title:
>   Cannot start a guest with more than 1TB of RAM
> 
> Status in QEMU:
>   Incomplete
> Status in qemu package in Ubuntu:
>   Incomplete
> 
> Bug description:
>   Attempting to start a KVM guest with more than 1TB of RAM fails.
> 
>   It looks like we might need some extra patches:
>   https://lists.gnu.org/archive/html/qemu-discuss/2017-12/msg00005.html
> 
>   ProblemType: Bug
>   DistroRelease: Ubuntu 18.04
>   Package: qemu-system-x86 1:2.11+dfsg-1ubuntu7
>   ProcVersionSignature: Ubuntu 4.15.0-20.21-generic 4.15.17
>   Uname: Linux 4.15.0-20-generic x86_64
>   ApportVersion: 2.20.9-0ubuntu7
>   Architecture: amd64
>   CurrentDesktop: Unity:Unity7:ubuntu
>   Date: Fri May  4 16:21:14 2018
>   InstallationDate: Installed on 2017-04-05 (393 days ago)
>   InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
>   MachineType: Dell Inc. XPS 13 9360
>   ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-4.15.0-20-generic root=/dev/mapper/ubuntu--vg-root ro quiet splash transparent_hugepage=madvise vt.handoff=1
>   SourcePackage: qemu
>   UpgradeStatus: Upgraded to bionic on 2018-04-30 (3 days ago)
>   dmi.bios.date: 02/26/2018
>   dmi.bios.vendor: Dell Inc.
>   dmi.bios.version: 2.6.2
>   dmi.board.name: 0PF86Y
>   dmi.board.vendor: Dell Inc.
>   dmi.board.version: A00
>   dmi.chassis.type: 9
>   dmi.chassis.vendor: Dell Inc.
>   dmi.modalias: dmi:bvnDellInc.:bvr2.6.2:bd02/26/2018:svnDellInc.:pnXPS139360:pvr:rvnDellInc.:rn0PF86Y:rvrA00:cvnDellInc.:ct9:cvr:
>   dmi.product.family: XPS
>   dmi.product.name: XPS 13 9360
>   dmi.sys.vendor: Dell Inc.
> 
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/qemu/+bug/1769053/+subscriptions
--
Dr. David Alan Gilbert / <email address hidden> / Manchester, UK


Crit prio on Qemu which was explained to work just fine is not correct IMHO.
After checking with David he meant to want to raise the prio on the suggested libvirt extensions instead. I'm re-triaging this bug for that and will ping David Berrange if work on this is already tracked on a libvirt-BZ or worked on in general.

Actually the qemu tasks are "invalid" not "incomplete" as they currently are - after our discussions here it seems we agreed that qemu is doing what is intended (and the reasons why larger bits are not the default). Therefore set the status to that for the qemu tasks.

Reported to upstream libvirt's BZ with the suggestions of Daniel Berrage and David Alan Glibert; now available at [1] I linked that up in the LP bug status so that we auto-track this.

As eventually this has to go upstream using the bug tracker should better ensure that there is no concurrent conflicting work (or opinion) on it.

[1]: https://bugzilla.redhat.com/show_bug.cgi?id=1578278

Since all but the libvirt task to expose these are set to invalid in regard to the issue here I'm changing the title accordingly.

As a short term solution for Ubuntu users I forked bug 1776189 to provide a machine type based solution until this here is implemented and widely available and exploited.

Description of problem:
Based on a discussion about Qemus ability to work with Guests >1TB [1] it was identified that it might be wise to have libvirt be able to:
  a) add a setting to the XML to specify the phys-bits
  b) It should be possible for libvirt to check the host it's on can
     satisfy that requirement (enough HW phys bits)
  c) libvirt can check that if RAM > 2^phys-bits it can complain

It is known that (c) can't catch all, as it might still fail if RAM+rounding+pci+hotplug space goes over the limit. Figuring that limit out is tricky and should not be part of the scope here.

[1]: https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1769053

Version-Release number of selected component (if applicable):
Up to latest 4.3

How reproducible:
100% - well it essentially is a feature request not an error

Steps to Reproduce:
1. try to control phys-bits through libvirt xml/api

Actual results:
No option exposed to do so.

Expected results:
Be able to control phys-bits

Additional info:
See the discussion on Launchpad [1] for more details of the qemu side of this.

Hi

We are hitting this bug. We have specialist hardwares including hi-memory hypervisors to run HPC workload on virtualised environment. This bug is affecting us at the machines which has more than 1TB of memory.

(In reply to <email address hidden> from comment #1)
> Hi
> 
> We are hitting this bug. We have specialist hardwares including hi-memory
> hypervisors to run HPC workload on virtualised environment. This bug is
> affecting us at the machines which has more than 1TB of memory.

This bz# is not a bug, but a feature planned to make live migration ability more flexible.  The option might be useful to work around bugs or other limitations, though.

If you are seeing a bug related to large guests or large hosts, please send more details so we can investigate it.

Hello.

Recently I had to deal with a VM with ~2.7 TB of RAM. The [open]SUSE QEMU package carries a patch for bumping the default maximum virtual address bits to 42 (from 40). Now, the last entry of the VM's e820 was this one:

    BIOS-e820: [mem 0x0000000100000000-0x000002b57fffffff] usable

Which, if I have computed correctly, is representable on 42 bits, so things should be fine. However, during boot, the VM shows this:

    L1TF: System has more than MAX_PA/2 memory. L1TF mitigation not effective

And if I look in /sys/devices/system/cpu/vulnerabilities/l1tf, I see this:

    l1tf: Vulnerable

This is because, while the RAM fits in MAX_PA=42, as soon as we take 1 bit off for PTE inversion, it does not fit any longer (in MAX_PA/2).

I understand that this is not critical per-se, but I think it's rather annoying for a user to see messages like the ones above, especially considering they're about vulnerabilities and security. And it's not necessarily easy for everyone to realize that L1TF is reported as vulnerable because QEMU is making the VM think that physical addresses are on 42 (or 40) bits.

So, I also think we need to be able to tweak this part of the VM configuration more easily, from libvirt. It's doable either by using specially modified CPU-models, or doing things like this, which are rather inconvenient:

    <qemu:commandline>
      <qemu:arg value='-cpu'/>
      <qemu:arg value='host,host-phys-bits=on'/>
    </qemu:commandline>

I also believe that host-phys-bits=on should be QEMU's default when the user chooses host as CPU model, but that's for another bugzilla. :-)

While the bugzilla case wasn't updated this landed in v8.7.0 via a series around
https://gitlab.com/libvirt/libvirt/-/commit/e6c29f09e5b75d7a8d79ae670407060446282c78

v9.0.0 of libvirt is in Ubuntu Lunar, due to that - from now on - one can control the physical bit settings in a defined way through libvirt.

See maxphysaddr in [1] for how to use that.

Mid term Ubuntu will consider no more adding further variants of the workaround, that was providing machine types with the -hpb suffix to allow larger guests.

[1]: https://libvirt.org/formatdomain.html#cpu-model-and-topology