Bhyve: fix SMBIOS Type 17 table generation
According to the SMBIOS specification (revision 2.7 or newer), the
extended module size field should only be used for sizes that can't
fit in the older size field.
Differential D24107
Bhyve: fix SMBIOS Type 17 table generation bcran on Mar 18 2020, 2:13 AM. Authored by Tags None Referenced Files
Details
Bhyve: fix SMBIOS Type 17 table generation According to the SMBIOS specification (revision 2.7 or newer), the Tested with FreeBSD: it now detects the correct amount of memory.
Diff Detail
Event TimelineComment Actions Looks good. You might want to see what happens with > 64GB (or maybe 128GB, can't recall the value). At some point additional tables are required for Windows. Comment Actions
That sounds like something for a different patch, but I'll certainly plan to test that: the biggest machine I have at home has 128GB RAM, but I see https://www.packet.com/ have machines with up to 384GB I can use. Comment Actions Ah, it's 32GB that's the limit: Windows Server 2008 R2 doesn't recognize more than that, I'm presuming because it doesn't know about the xsize field that was introduced around 2009 to support larger DIMMs. Comment Actions In looking at the SMBios 2.7 change list in DSP01342.7.1.pdf (final version of 2.7) on page 134 There is a memory device (type 17) update that you also need to implement to allow DIMM's >32GB. In my work on VM_MAXCPU's I found it would actually be desirable at some point to get to 3.X version of some form, can not recall exactly what the minimum was right now, but reading a newer change log I see some interesting things like in 3.0.0 add GUID value for discovering SMBIOS tables in UEFI, which iirc would help our UEFI situation, add new entry for extended BIOS ROM size, oh here it is 3.0.0 Type 4, extned core, core eabled and thread count ranges. Looking at the change list in the 3.3.0 spec between 2.6 and 3.0.0 is not a huge task as much of it does not apply to bhyve. But I think to bump so 27 you must implement the device type 17 change with this one, which fixes your current issue any way.
Comment Actions This code should work without a need to split memory up into 32GB Dimms
Comment Actions
bhyve/UEFI has always searched for the SMBIOS table in memory and used that.
Comment Actions Sorry, I only just saw the more recent comments. The problem is that older operating systems don't know to look at the extended field, and only ever look at the field which has a maximum value of 32GB.
Comment Actions I think we should go with 2.7 btw. Systems shouldn't read 2.7 fields if we advertise 2.6 since those fields "shouldn't exist". OTOH, the spec does say systems are permitted to use the length of individual structures to determine which optional fields exist. Comment Actions That is what the 0x7fff value is for when using extended btw, is to report the max possible size for legacy systems. I agree that we should use the non-extended size when it fits. In re-reading the descriptions of types 17 and 19, I think we probably should only do 1 type 17 entry that is lomem + himem. We already DTRT for having separate type 19 entries for lomem and himem. This is similar to an i386 system with 4GB of RAM in one DIMM. You would have two type 19 entries, 1 for memory from 0 to the memio hole (3.5 GB or so) and one for the rest of RAM starting at 4GB, but you would have one type 17 entry for a 4GB DIMM. That would mean removing the whole 'guest_himem' case from type 17's initializer and using conditional logic as Rod suggested to set size or extended size to the total memory size. Comment Actions The seperate review would just correct the code so that bcdrev is derived from major/minor, then this review can do the bump to 2.7? Rebecca is it ok with you if I go create a review to do the bcdrev fix? Comment Actions I just checked and @rgrimes is right: when the size field is set to 0x7FFF, dmidecode reports the RAM as "Size: 0 TB" - so we need to use the extended size field for anything equal to or greater than that. "For compatibility with older SMBIOS parsers, memory devices smaller than (32 GB - 1 MB) 1399 should be represented using their size in the Size field, leaving the Extended Size field set to 0." So we _should_ use the non-extended size when it fits. Comment Actions
Comment Actions There is no need to error out on overflow here. The type17 isn't used by most o/s's for determining how much memory is available: there is e820, the EFI memory map, etc etc. Perhaps print an error in bhyve, buit there doesn't seem any point in erroring out. Comment Actions Okay. Also, I don't think we're going to have guests configured with ~2PB memory any time in the near future :) Comment Actions Indeed :) And when 5-level paging h/w is available there will be a lot more changes needed than just htis. Misconfigurations of guest memory that go past the supported host address lines will be caught earlier than this, and in a review I should be posting shortly. Comment Actions I disagree, if infact for some reason that value has gotten >2PB something has gone wrong and what your going to end up with is certainly not what the user wanted.
Comment Actions @rgrimes Could you approve the latest patch, or provide comments on what should be changed please?
Comment Actions I am happy with the other fixes, not sure if there is a need to fix or error check memory size bit overflows
|