[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200914215411.GF7192@sjchrist-ice>
Date: Mon, 14 Sep 2020 14:54:11 -0700
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org, Uros Bizjak <ubizjak@...il.com>,
Andi Kleen <ak@...ux.intel.com>
Subject: Re: [PATCH 1/2] KVM: VMX: Move IRQ invocation to assembly subroutine
On Mon, Sep 14, 2020 at 04:38:13PM -0500, Josh Poimboeuf wrote:
> On Mon, Sep 14, 2020 at 02:07:19PM -0700, Sean Christopherson wrote:
> > > RSP needs to be aligned to what? How would this align the stack, other
> > > than by accident?
> >
> > Ah, yeah, that's lacking info.
> >
> > 16-byte aligned to correctly mimic CPU behavior when vectoring an IRQ/NMI.
> > When not changing stack, the CPU aligns RSP before pushing the frame.
> >
> > The above shenanigans work because the x86-64 ABI also requires RSP to be
> > 16-byte aligned prior to CALL. RSP is thus 8-byte aligned due to CALL
> > pushing the return IP, and so creating the stack frame by pushing RBP makes
> > it 16-byte aliagned again.
>
> As Uros mentioned, the kernel doesn't do this.
Argh, apparently I just got lucky with my compiles then. I added explicit
checks on RSP being properly aligned and thought that confirmed the kernel
played nice. Bummer.
Powered by blists - more mailing lists