-
ryao
Does anyone know what FM_EREPORT_ENA means? It is generated in fm_ena_generate_cpu(). ((gethrtime() << ENA_FMT1_TIME_SHFT) causes an overflow that trips linux's kernel UBSAN. I am trying to decide how to address this, but I am not happy with my present ideas and I suspect knowning what ENA means would help me decide on a resolution.
-
rmustacc
Error Numeric Association. It's mean to be a unique value while dealing with a producer and transport until it reaches the fault manager.
-
rmustacc
Part of it is designed to include timestamps to help with correlation.
-
ryao
The timestamp values are overflowing it, so correlation will have issues with wraparound. :/
-
rmustacc
It wasn't intended to have the whole timestamp.
-
ryao
Anyway, I guess the solution is to just mask it to suppress the UBSAN complaints.
-
rmustacc
The value is already masked after shifts.
-
rmustacc
So it's not like changing that around to reduce ub is a problem.
-
ryao
UBSAN will complain about any shift that does an implicit mask via an overflow: [ 8849.494447] left shift of 8836735852418 by 20 places cannot be represented in type 'long long int'
-
ryao
Masking before the shift to prevent an overflow will suppress the complaint.
-
rmustacc
Yes, I understand. My point was that moving around where the masking is doesn't change the intended effect, so it's not a big deal to move it.
-
ryao
Alright. Thanks. :)
-
KungFuJesus
hmm: adam@sqlbox:/home/adam$ sudo zpool trim sqlpool
-
KungFuJesus
cannot trim 'hole': no such device in pool
-
KungFuJesus
I believe I added a slog, removed it, and re-added it
-
KungFuJesus
looks like this guy:
openzfs/zfs #10906
-
KungFuJesus
Not sure if the fix for that depends on other commits or not, but it seems like an issue that's easy to hit, particularly if _any_ flash device gets removed/replaced
-
tsoome
KungFuJesus seems so.
-
ryao
I asked in ##c about why that is undefined and they pointed out that the standard specifies it is undefined on signed types, but not unsigned ones. I am not sure why hrtime_t is signed. I guess changing it now would be a headache. :/
-
ryao
I had been reasoning about hrtime_t as a unsigned type until now, despite UBSAN telling me otherwise, since it makes no sense for it to be signed... :/
-
KungFuJesus
I chased similar ghosts with ubsan trying to debug some stuff in nouveau on big endian
-
KungFuJesus
FWIW, switching things to unsigned types for the mask had no discernible difference in behavior, but I imagine a compiler _could_ take some liberties with that wiggle room
-
ryao
-
ryao
So far, no complaints. The other way to avoid this would be to change hrtime_t to unsigned.
-
rmustacc
It's not changing.
-
rmustacc
You can, but also the point of it is to be able to subtract values, so you're trading off negative values for underflow.
-
KungFuJesus
yeah, I'd figure negative timestamp values for a high resolution timespec are meaningful for that very purpose
-
rmustacc
Especially when it's all about relative measurements.
-
ryao
That makes sense.
-
ryao
Ubuntu's paste bin service requires a login. -_-
-
KungFuJesus
Just curious, does Illumos use bit level fields in any of its data structures? I found a pretty brutal bug in GCC with that that's maybe not being backported as far as 11
-
ryao
-
rmustacc
KungFuJesus: Yes, we have structures whose members are bitfields.
-
KungFuJesus
It affects all CPUs when the store merging optimization is enabled (O2 enables this). My minimal reproducer was on big endian powerpc, but technically all endiannesses are affected
-
rmustacc
What versions of gcc does it impact?
-
KungFuJesus
-
KungFuJesus
-
rmustacc
It looks like this was intoduced in gcc11?
-
ryao
If I read correctly, it affects GCC 11.0 through GCC 12.2.
-
KungFuJesus
looks like they only backported to 12? At least from what I can tell with the PR's message chain
-
ryao
The last message suggested it is fixed in what will become GCC 12.3.
-
KungFuJesus
rmustacc: hah, got lucky switching to 10, I guess
-
ryao
I had been wondering why Gentoo has been shipping GCC snapshots. I guess this explains it.
-
KungFuJesus
They never addressed how suboptimal the code was for generating those GPU instructions compared to clang. It definitely didn't leave a good taste in my mouth for GCC on PPC, anyway
-
KungFuJesus
everything managing to spill to the stack there several times over when there's like 31 or 32 GPRs to work with
-
ryao
KungFuJesus: I learned that GCC on PPC generates very suboptimal code during my adventures with fletcher4 GNU C vector code late last year.
-
ryao
That is one of the things that I recall observing too.
-
ryao
Although it had a vector lowering issue on all architectures in addition to that, plus other miscellaneous issues.
-
KungFuJesus
Yeah, I followed that thread as well (I'm a commenter in there, somewhere). To some degree it's understandable for the vectorized code path because until like Power8, there was no way to go from GPR to vector register
-
KungFuJesus
but yeah, still super suboptimal for load-store
-
ryao
It is still a WIP that I intend to revisit hopefully this quarter.
-
ryao
KungFuJesus: Also, to give an example, see efi_gpe_Attrs_t in usr/src/uts/common/sys/efi_partition.h.
-
ryao
KungFuJesus: By the way, there is another issue involving bitfields. Apparently, there are no ordering guarantees, so they cannot be used for structures that are written to disk. Whether efi_gpe_Attrs_t is written to disk is unclear. There is a function called efi_write() that is a pain to read that might write it to disk, in which case, we need to change things...
-
ryao
-
KungFuJesus
ryao: oof, isn't there a lot of code that relies on bit exact ordering in bitfields?
-
ryao
I rarely ever see them used, so I would think not, but that needs to be checked...
-
KungFuJesus
nouveau certainly does - the reproducer I have there is generating nv30-specific instructions
-
ryao
KungFuJesus: Ouch. They probably should not be using that to talk to hardware. Different compilers could reorder things in bad ways.
-
KungFuJesus
hmm, wonder if someone should let #mesa know
-
ryao
Probably.
-
rmustacc
It's ultimately part of the ABI.
-
KungFuJesus
my bad, they aren't:
gitlab.freedesktop.org/mesa/mesa/-/…s/nouveau/nv30/nvfx_vertprog.c#L295 Looks like the "emit" function writes to 32 bit words
-
ryao
rmustacc: Are you referring to efi_gpe_Attrs_t? If that is the case and we really are writing it out to disk, then we need to make a serialization function to fix it. -_-
-
rmustacc
I mean, in general.
-
rmustacc
See sys/isa_defs.h and _BIT_FIELDS_HTOL and _BIT_FIELDS_LTOH:.
-
KungFuJesus
given that fact though, it does seem a little silly to bother with bit packing fields at all. Probably just creating a lot of overhead letting GCC figure out the instruction sequence to pack and extract them
-
rmustacc
It all depends on what your interface is.
-
rmustacc
If your register definition is in bitfields, you have to extract it somehow.
-
rmustacc
There are a bunch of different approaches to bit manip and they all have tradeoffs.
-
rmustacc
The approach say the nvme driver is using makes a bunch of things simpler when you have well defined fields. Things like some of the bitext experiments have different benefits.
-
ryao
I am a fan of the BF64_GET() and BF64_SET() macros and friends in ZFS.
-
KungFuJesus
does that wrap xgetbv under the hood with x86 or something?
-
rmustacc
Sure, it's a variant of the what was BITX, and what we made type safe with sys/bitext.h.
-
ryao
KungFuJesus: See usr/src/uts/common/fs/zfs/sys/bitops.h
-
ryao
In any case, relying on the order of bitfields is undefined behavior, which will likely bite people if it is being read/written to/from either a disk or the network.
-
ryao
Since compilers are free to reorder them.
-
KungFuJesus
ah, using generic macros with xor to set only the changed bits
-
ryao
Yes. :)
-
KungFuJesus
certainly portable, may not always be what you want for optimal, though
-
ryao
I need to review whether the EFI code is actually writing the structures with bitfields out when I have more time. efi_write() is not easy to read and I have a high priority bug to fix rigth now...
-
ryao
KungFuJesus: Correct behavior is priority number 1. Speed is priority number 2. Compilers might also be able to optimize away inefficiency with something that commonly done...
-
KungFuJesus
right, the bit test instruction is almost always what you want for the "get" on x86
-
ryao
That said, these operations are not done in any critical loops as far as I know, so whether they are being done optimally is not super important.
-
ryao
Also, just out of curiosity, why is illumos still using GCC instead of Clang?
-
richlowe
because it's a fucking lot of work to change?
-
ryao
I was able to ask if it was ENOTIME. I guess that would be it.
-
ryao
s/able/about/
-
richlowe
toomas is working on it for at least a shadow
-
richlowe
to catch bugs
-
ryao
Neat.
-
richlowe
I often use clang-tidy by hand to see if I've screwed something up
-
KungFuJesus
I don't doubt that, but it does seem worthwhile for license related issues, alone
-
richlowe
pmooney, andyf: Is there a set of privs I could give myself to run bhyve?
-
richlowe
as me
-
ryao
Clang is also a better compiler as far as I can tell.
-
KungFuJesus
For a while that wasn't always the case, at least on x86. It seems I've found a lot of counter-cases for that addage, lately. GCCs usage of the k-mask registers on AVX512 is a bit too eager to move things to GPRs even when it's of no benefit to do so
-
pmooney
richlowe: sorry, it's limited to root right now
-
pmooney
fenix #12714
-
fenix
FEATURE 12714: want privilege for hypervisors (New)
-
fenix
-
ryao
Clang has a cleaner codebase with fewer miscompilation bugs on common architectures (although I have heard bad things about its SPARC support). Unlike GCC's codebase, which makes one want to gorge out their eyes upon reading it, Clang's codebase makes heavy use of various C++ language features that make it a pain to figure out where functions are implemented. :/
-
pmooney
I also need to write an IPD about resource limits for vmm reserovoir consumption and vCPU count
-
pmooney
I think it would be useful to be able to constrain those per-zone
-
pmooney
rather than the current hard limit of one bhyve VM in a zone at any given time
-
pmooney
(GZ excluded, of course)
-
ryao
Also, while I am talking about compilers... it is a shame that this compiler is proprietary:
compcert.org
-
andyf
Worth noting that bhyve drops a load of privs after it gets going, which is nice
-
andyf
-
pmooney
I should teach propolis to do that too
-
richlowe
that's a good answer. privs would be nice, but I understand it might get annoying in more deployed situations
-
ryao
When did illumos switch from KVM to byhve? I heard about it last month and it was news to me when I heard that.
-
andyf
The initial commit of bhyve to illumos-gate was in May 2020. Most distributions still support KVM and bhyve, but bhyve is where all of the new work is going.
-
papertigers
pmooney:
crates.io/crates/illumos-priv if you get around to it. Let me know if there's anything you would like to see there
-
papertigers
glancing at that, it could use some of the additional privset wrappers for things like intersection. Would be happy to add those things if they would be useful. I might be the only one using this crate
-
Smithx10
pmooney: propolis-server runs in the GZ or in a zone?
-
pmooney
intended to run in a zone
-
Smithx10
And just manages 1 VM
-
pmooney
yep
-
Smithx10
k, just making sure. Was playing around with "Cloud-Hypervisor" on Linux and was trying to confirm some things
-
pmooney
didn't want to give up those isolation benefits
-
kebe_
Yeah you REALLY want that second hull in place. ):
-
kebe_
:)
-
nomad
. o O ( Security, it's a hull of a thing. )
-
gitomat
[illumos-gate] 15196 libdladm: comparison of integers of different signs -- Toomas Soome <tsoome⊙mc>