Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3940904pxk; Tue, 22 Sep 2020 06:41:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxg1xrn7iKuqMasNc+ey9JZ4OFFiMFt7rcEpJ/5W/+c4TfqFQ4BwNjQMVUbEnW2895nz4S X-Received: by 2002:a50:cbc7:: with SMTP id l7mr4029094edi.148.1600782067051; Tue, 22 Sep 2020 06:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600782067; cv=none; d=google.com; s=arc-20160816; b=GdUpvXWo4+MUM6UEAdNTYEZD9rcU5WBad2Ui+P0pp4CN85lb2vpJ34/RYUkqyq5HhI t0QoX0j9ThfcvqgaEDJK/Bj4S0Vtfqmt8FN3HHGyHePWxQBM/RT0W0nBNkg+vW6VAA7j tJbhLmXK44zR/5k5dfhAKenFR4mPfVe50Hsh6HCwr+zrINRhfQWNc331hr98hSpqBxiW mx+vqVgw9MGuCjOTh5ybJg4X7c8BiyVQo/fmRGVOk4uaNqMULEB1HbKowFyLTJsbk+v6 Rri9xnY0egG/nq+K7kNXrMAp3dDgH/kndjsA//i5Q52/F/EzEsLM4riueQnECdBVhQXu q6Zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=WKA+W9RGb28j92jAhf1JQdc576NbRme2KTggAyn0cGE=; b=bQIQrnREb54u6DiVunjNwDYa6A3CcCyNrNAOHd1dU/xitOELXN3fc9hmXZXlTf9XRI awn+MttWeKWNapAz3PCHU39FUCSsbE342jotPeMzfGG22ulXIp5mjKhnCuOO0caal866 90nIoVjtwbc8b13XKaeNl1hqE/RZBRpL5zUXLCuUIUKHEJ2pyPw1kQtJzM1IFXd1hudH /fLZHd3QIVDEtJQhd4FBGFZA47RVdamzUhncM1oYtleC3AZB4nr9hrr2NjI1VePMXhg7 oL6iX4QpuGgV+YxbBuP+C2KQ8Wq67IsCJbEUqIDqtNs7XF8Wl7m0S8hYyzsyyGekFZIg DLqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f3dG14wE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s14si10538462ejx.304.2020.09.22.06.40.43; Tue, 22 Sep 2020 06:41:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=f3dG14wE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726701AbgIVNiw (ORCPT + 99 others); Tue, 22 Sep 2020 09:38:52 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:22258 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726702AbgIVNia (ORCPT ); Tue, 22 Sep 2020 09:38:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600781908; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WKA+W9RGb28j92jAhf1JQdc576NbRme2KTggAyn0cGE=; b=f3dG14wEUqDn2aB1m7zPz4zuaqlIv+he18EO60OSdWqgle6n1ppg9aCoI0qKPooWDMn81q AHGfvo5BSDmuQEGMQcq48cfv5xT+Jc7upd39FNon310qhsaXMO/2ChqVg1TlAZTt2fPcxq wj+vg2igqsIUgCj56Z5MwrCpWN1Tytc= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-291-muhq-NKSOr2iqRDtbR53Ng-1; Tue, 22 Sep 2020 09:38:27 -0400 X-MC-Unique: muhq-NKSOr2iqRDtbR53Ng-1 Received: by mail-wr1-f72.google.com with SMTP id y3so7420561wrl.21 for ; Tue, 22 Sep 2020 06:38:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=WKA+W9RGb28j92jAhf1JQdc576NbRme2KTggAyn0cGE=; b=qqdDnYun5VynOVSzE5dvqdzVD7ono2RPYLt+l1q8p9Vs5dcKLzuLV2ynuioEt+Xibn Gdzaja6AqlKRfcA+6+Q9mQb+LTGu+jHayQrWltqLZIrLwRQeZnl7n6BpVnIF6o19goNl fc12A0mEtMuks0lpqsisDKTqvvn/mqvae1QxMYua6QBqMkmucG3ILUVxvIR4rMW+m6mM 0FkbUZTgi4t6xPYKdKcuIeTLDD0uXQXGXhOmLD9bgad6bPTwQrUXPbSX6l0C98qf0P9G /ylPZ5iaVfJbLwoTL+jxA/PQGdHd+834xSd10CCOv/WWFOOdP7xo3sVaIZPbj7qofLId WWwA== X-Gm-Message-State: AOAM532QW6O161ltsqY9NQfg7mNi76yr0uI46Nm8obsO3kRnaPiYTQb/ q4Y+LB9JSu5bJlg0JjMHUJz/8aKZMB+AqshpBbnB1EW9SXmQIOo9LnN6jfbhjz0iun1YzMbYH1q iwCUYuefEhrTF9f5J5SrSiDaL X-Received: by 2002:adf:f88b:: with SMTP id u11mr5298173wrp.376.1600781905830; Tue, 22 Sep 2020 06:38:25 -0700 (PDT) X-Received: by 2002:adf:f88b:: with SMTP id u11mr5298147wrp.376.1600781905609; Tue, 22 Sep 2020 06:38:25 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:ec2c:90a9:1236:ebc6? ([2001:b07:6468:f312:ec2c:90a9:1236:ebc6]) by smtp.gmail.com with ESMTPSA id c14sm27546575wrm.64.2020.09.22.06.38.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Sep 2020 06:38:25 -0700 (PDT) Subject: Re: [PATCH v2 0/2] KVM: VMX: Clean up IRQ/NMI handling To: Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , Uros Bizjak , Andi Kleen References: <20200915191505.10355-1-sean.j.christopherson@intel.com> From: Paolo Bonzini Message-ID: <4a6aaa8a-c62c-5f7c-da3e-14a68a835487@redhat.com> Date: Tue, 22 Sep 2020 15:38:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200915191505.10355-1-sean.j.christopherson@intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 15/09/20 21:15, Sean Christopherson wrote: > Clean up KVM's handling of IRQ and NMI exits to move the invocation of the > IRQ handler to a standalone assembly routine, and to then consolidate the > NMI handling to use the same indirect call approach instead of using INTn. > > The IRQ cleanup was suggested by Josh Poimboeuf in the context of a false > postive objtool warning[*]. I believe Josh intended to use UNWIND hints > instead of trickery to avoid objtool complaints. I opted for trickery in > the form of a redundant, but explicit, restoration of RSP after the hidden > IRET. AFAICT, there are no existing UNWIND hints that would let objtool > know that the stack is magically being restored, and adding a new hint to > save a single MOV , instruction seemed like overkill. > > The NMI consolidation was loosely suggested by Andi Kleen. Andi's actual > suggestion was to export and directly call the NMI handler, but that's a > more involved change (unless I'm misunderstanding the wants of the NMI > handler), whereas piggybacking the IRQ code is simple and seems like a > worthwhile intermediate step. > > Sean Christopherson (2): > KVM: VMX: Move IRQ invocation to assembly subroutine > KVM: VMX: Invoke NMI handler via indirect call instead of INTn > > arch/x86/kvm/vmx/vmenter.S | 34 +++++++++++++++++++++ > arch/x86/kvm/vmx/vmx.c | 61 +++++++++++--------------------------- > 2 files changed, 51 insertions(+), 44 deletions(-) > Queued, thanks. Paolo