On Fri, Mar 11, 2022 at 10:06 AM Joerg Roedel <jroedel@xxxxxxx> wrote: > > On Thu, Mar 10, 2022 at 03:25:04PM -0600, Michael Roth wrote: > > Joerg, do you have more background on that? Would it make sense, outside > > of this series, to change it to a terminate? Maybe with a specific set > > of error codes for ES_{OK,UNSUPPORTED,VMM_ERROR,DECODE_FAILED}? > > This seems to be a left over from development of the SEV-ES guest > patch-set. I wanted to see whether the VM crashed due to a triple fault > or an error in the #VC handler. The halt loop can be replaced by > termination request now. > > > > I am still working on why the early_printk()s in that function are not > > > working, it seems that they lead to a different halt. > > > > I don't see a different halt. They just don't seem to print anything. > > (keep in mind you still need to advance the IP or else the guest is > > still gonna end up spinning here, even if you're removing the halt loop > > for testing purposes) > > The early_printks() also cause #VC exceptions, and if that handling is > broken for some reason nothing will be printed. > > > > > > working, it seems that they lead to a different halt. Have you tested > > > any of those error paths manually? For example if you set your CPUID > > > bits to explicitly fail here do you see the expected printks? > > > > I think at that point in the code, when the XSAVE stuff is setup, the > > console hasn't been enabled yet, so messages would get buffered until they > > get flushed later (which won't happen since there's halt loop after). I > > know in some cases devs will dump the log buffer from memory instead to get > > at the error messages for early failures. (Maybe that's also why Joerg > > decided to use a halt loop there instead of terminating?) > > It is hard to dump the log-buffer from encrypted memory :) But I > remember having seen messages from these early_printks under SEV-ES for > different bugs. Not sure why they don't appear in this situation. > > > So maybe reworking the error handling in handle_vc_boot_ghcb() to use > > sev_es_terminate() might be warranted, but probably worth checking with > > Joerg first, and should be done as a separate series since it is not > > SNP-related. > > I am fine with this change. I'll send a patch out for that. I was also thinking about adding a vcpu run exit reason for termination. It would be nice to get a more informative exit reason than -EINVAL in userspace. Thoughts? > > Regards, > > -- > Jörg Rödel > jroedel@xxxxxxx > > SUSE Software Solutions Germany GmbH > Maxfeldstr. 5 > 90409 Nürnberg > Germany > > (HRB 36809, AG Nürnberg) > Geschäftsführer: Ivo Totev >