Joerg Roedel
2020-Jun-23 12:12 UTC
Should SEV-ES #VC use IST? (Re: [PATCH] Allow RDTSC and RDTSCP from userspace)
On Tue, Jun 23, 2020 at 01:50:14PM +0200, Peter Zijlstra wrote:> If SNP is the sole reason #VC needs to be IST, then I'd strongly urge > you to only make it IST if/when you try and make SNP happen, not before.It is not the only reason, when ES guests gain debug register support then #VC also needs to be IST, because #DB can be promoted into #VC then, and as #DB is IST for a reason, #VC needs to be too. Besides that, I am not a fan of delegating problems I already see coming to future-Joerg and future-Peter, but if at all possible deal with them now and be safe later. Regards, Joerg
Peter Zijlstra
2020-Jun-23 13:03 UTC
Should SEV-ES #VC use IST? (Re: [PATCH] Allow RDTSC and RDTSCP from userspace)
On Tue, Jun 23, 2020 at 02:12:37PM +0200, Joerg Roedel wrote:> On Tue, Jun 23, 2020 at 01:50:14PM +0200, Peter Zijlstra wrote: > > If SNP is the sole reason #VC needs to be IST, then I'd strongly urge > > you to only make it IST if/when you try and make SNP happen, not before. > > It is not the only reason, when ES guests gain debug register support > then #VC also needs to be IST, because #DB can be promoted into #VC > then, and as #DB is IST for a reason, #VC needs to be too.Didn't I read somewhere that that is only so for Rome/Naples but not for the later chips (Milan) which have #DB pass-through?> Besides that, I am not a fan of delegating problems I already see coming > to future-Joerg and future-Peter, but if at all possible deal with them > now and be safe later.Well, we could just say no :-) At some point in the very near future this house of cards is going to implode. We're talking about the 3rd case where the only reason things 'work' is because we'll have to panic(): - #MC - #DB with BUS LOCK DEBUG EXCEPTION - #VC SNP (and it ain't a happy accident they're all IST) Did someone forget to pass the 'ISTs are *EVIL*' memo to the hardware folks? How come we're getting more and more of them? (/me puts fingers in ears and goes la-la-la-la in anticipation of Andrew mentioning CET)
Joerg Roedel
2020-Jun-23 14:49 UTC
Should SEV-ES #VC use IST? (Re: [PATCH] Allow RDTSC and RDTSCP from userspace)
On Tue, Jun 23, 2020 at 03:03:22PM +0200, Peter Zijlstra wrote:> On Tue, Jun 23, 2020 at 02:12:37PM +0200, Joerg Roedel wrote: > > On Tue, Jun 23, 2020 at 01:50:14PM +0200, Peter Zijlstra wrote: > > > If SNP is the sole reason #VC needs to be IST, then I'd strongly urge > > > you to only make it IST if/when you try and make SNP happen, not before. > > > > It is not the only reason, when ES guests gain debug register support > > then #VC also needs to be IST, because #DB can be promoted into #VC > > then, and as #DB is IST for a reason, #VC needs to be too. > > Didn't I read somewhere that that is only so for Rome/Naples but not for > the later chips (Milan) which have #DB pass-through?Probably, not sure which chips will get debug register virtualization under SEV-ES. But even when it is supported, the HV can (and sometimes will) intercept #DB, which then causes it to be promoted to #VC.> We're talking about the 3rd case where the only reason things 'work' is > because we'll have to panic(): > > - #MCOkay, #MC is special and can only be handled on a best-effort basis, as #MC could happen anytime, also while already executing the #MC handler.> - #DB with BUS LOCK DEBUG EXCEPTIONIf I understand the problem correctly, this can be solved by moving off the IST stack to the current task stack in the #DB handler, like I plan to do for #VC, no?> - #VC SNPThis has to panic for other reasons that can't be worked around. It boils down to detecting that the HV is doing something fishy and bail out to avoid further harm (like in the #MC handler). Regards, Joerg
Andrew Cooper
2020-Jun-23 15:22 UTC
Should SEV-ES #VC use IST? (Re: [PATCH] Allow RDTSC and RDTSCP from userspace)
On 23/06/2020 14:03, Peter Zijlstra wrote:> On Tue, Jun 23, 2020 at 02:12:37PM +0200, Joerg Roedel wrote: >> On Tue, Jun 23, 2020 at 01:50:14PM +0200, Peter Zijlstra wrote: >>> If SNP is the sole reason #VC needs to be IST, then I'd strongly urge >>> you to only make it IST if/when you try and make SNP happen, not before. >> It is not the only reason, when ES guests gain debug register support >> then #VC also needs to be IST, because #DB can be promoted into #VC >> then, and as #DB is IST for a reason, #VC needs to be too. > Didn't I read somewhere that that is only so for Rome/Naples but not for > the later chips (Milan) which have #DB pass-through?I don't know about hardware timelines, but some future part can now opt in to having debug registers as part of the encrypted state, and swapped by VMExit, which would make debug facilities generally usable, and supposedly safe to the #DB infinite loop issues, at which point the hypervisor need not intercept #DB for safety reasons. Its worth nothing that on current parts, the hypervisor can set up debug facilities on behalf of the guest (or behind its back) as the DR state is unencrypted, but that attempting to intercept #DB will redirect to #VC inside the guest and cause fun. (Also spare a thought for 32bit kernels which have to cope with userspace singlestepping the SYSENTER path with every #DB turning into #VC.)>> Besides that, I am not a fan of delegating problems I already see coming >> to future-Joerg and future-Peter, but if at all possible deal with them >> now and be safe later. > Well, we could just say no :-) At some point in the very near future > this house of cards is going to implode.What currently exists is a picture of a house of cards in front of something which has fallen down.> Did someone forget to pass the 'ISTs are *EVIL*' memo to the hardware > folks? How come we're getting more and more of them?I have tried to get this point across.? Then again - its far easier for the software folk in the same company as the hardware folk to make this point.> (/me puts fingers > in ears and goes la-la-la-la in anticipation of Andrew mentioning CET)I wasn't going to bring it up, but seeing as you have - while there are prohibitively-complicating issues preventing it from working on native, I don't see any point even considering it for the mess which is #VC, or the even bigger mess which is #HV. ~Andrew
Seemingly Similar Threads
- Should SEV-ES #VC use IST? (Re: [PATCH] Allow RDTSC and RDTSCP from userspace)
- Should SEV-ES #VC use IST? (Re: [PATCH] Allow RDTSC and RDTSCP from userspace)
- Should SEV-ES #VC use IST? (Re: [PATCH] Allow RDTSC and RDTSCP from userspace)
- Should SEV-ES #VC use IST? (Re: [PATCH] Allow RDTSC and RDTSCP from userspace)
- Should SEV-ES #VC use IST? (Re: [PATCH] Allow RDTSC and RDTSCP from userspace)