Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp2476533rdb; Thu, 21 Sep 2023 22:33:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHP8+BjuV58lWusVa8OxRBPNfxN6j1mA0js+BCWiIS17UHj2RfgsC39wFWzfVuNfzvtah8i X-Received: by 2002:a05:6a20:13d9:b0:15d:8f1a:6a4c with SMTP id ho25-20020a056a2013d900b0015d8f1a6a4cmr2188279pzc.20.1695360812453; Thu, 21 Sep 2023 22:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695360812; cv=none; d=google.com; s=arc-20160816; b=rh+D5w22KUTEX9UWSC19mfEcUvg1097TC8cG/e3gcTUvaHg3zI3nQf4TIza0dXT/A4 9JW+pZ/cYvKMNkSwNV4TgnhFpnke9jQ9oH44HSMrm7AahnIvVegGMSML3/d7atprYZ3L aCRk+5Bubk3Pq8f6plI6fcuSpJXsm4Y19A5xLIqTEp1KEWzYf4Ffd8H0U5/du2fYxfiS 3bvMnkkr97RJ3B3qvNpOAatKYeAfT/e4qsbQ0bkLHEQZ82li21meW/73x4K6rvjYpsJi S5mtNRc7HhfAvM0bBkuuXb0jKk+w0eQgNddh58okQrWjcPQP2AmDPgEjFXjwfVmiDXT5 m+gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=jkSn+PxPk9HUDFePBeJ+qJj/mQ3EC7rJPAPt5aKMVQM=; fh=pjkya/nKZpDFoHtIxMilalFHz2o+QICdGGc2hLh8FNc=; b=JwJXWdWVztwpHDCWidRKPxZKXxJhoiUysyBVt+DKfqombQ+AN1w/oda8y59zM0tStC SLBh+4L2jY5/3JR6q7XjhP+4nn5Vm7qlhSB86k/99envhyViutYJjGtMGbksP+oozA8X jlXHvRBrcc4klsdUv58JQK8Sxh8A3Lc9RlumCdJtZrwJaFcajc4BraxJigiSSaKZgAAI vT9JaliBCikw4arBka8Fp6BfVcLMicMmOE1ZVV83PIAuYY/qMQZ7F+7mke42D0weyDqq HKNpLERDEbqH9RjmsRcQCoeRmYD2v7IQGZZ7peFf8XwT8Ebd6vzC05alGnTYQdbQqxMC HO1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KovBpHvp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id a19-20020a17090ad81300b00274df27f882si3220269pjv.35.2023.09.21.22.33.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 22:33:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KovBpHvp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 25C8E80779AE; Thu, 21 Sep 2023 09:59:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229625AbjIUQ7j (ORCPT + 99 others); Thu, 21 Sep 2023 12:59:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbjIUQ7d (ORCPT ); Thu, 21 Sep 2023 12:59:33 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F2541BD5 for ; Thu, 21 Sep 2023 09:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1695315444; 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=jkSn+PxPk9HUDFePBeJ+qJj/mQ3EC7rJPAPt5aKMVQM=; b=KovBpHvpK2l2HEEWpFpEbjUdaZsC4eAlr9AEixDYkkFh1E+DhQ31h2+IKnXLDaDiYZDCBh J7OTqPC7nZ/kpx4rck00F6s5092NbVhKJ6j04tN59jDbKwxoB3DaamtHxzEq0ANRuGdpow FCuP2TLpopLKXNQCJ3l1aJ9uEpVla2E= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-610-S9jEhQ5gN36NVNHjAB6nbQ-1; Thu, 21 Sep 2023 08:38:52 -0400 X-MC-Unique: S9jEhQ5gN36NVNHjAB6nbQ-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-3f5df65fa35so6819675e9.3 for ; Thu, 21 Sep 2023 05:38:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695299931; x=1695904731; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jkSn+PxPk9HUDFePBeJ+qJj/mQ3EC7rJPAPt5aKMVQM=; b=VCbyrjxtBNmxAFqTuVQ/c232XcF/KMrBPiB2RUfT/O/nlfMA9hYg98ZvWrVqfojYZg gN5JBuE7MyNczr8UmCLEEo/hS+p5ZeUpU1cENoATPYyXaNm5KY8M3lVawRULRqgQdpiv dHHAIk9RG635Jh+fkynIPrUPVLBhsts9M43lnEny+fPgyor1FPZnKRv2uSdtnPy0EnHr UUmLxew5rlt6lmdR9w/kCnrG2DPT4o34Z48EPEj4WxA048rAK8vj5O3+2BhPE6XtmJVR yXqtgs+5c0/O0H/Bo7mWpur4YoHrwO1skqybw7550TyrSYe8xfO6zqjHio0DttG8xBhr gfVQ== X-Gm-Message-State: AOJu0YzmefPcD/p2lLF4xEHaZcgTLyn0jiA2pZAYQoLOTbPGF7k6rQ84 LZuycBTcXyBRNqW0KCEcYEWKwYyU3fiT14+stGFqfJKkxWPpsRX1XRo876mB1yPP2vomftwlfve j1rAx68rIZVZU3IVbkR5JfIi/ X-Received: by 2002:a05:600c:2218:b0:3fe:d7c8:e0d with SMTP id z24-20020a05600c221800b003fed7c80e0dmr5342829wml.34.1695299931205; Thu, 21 Sep 2023 05:38:51 -0700 (PDT) X-Received: by 2002:a05:600c:2218:b0:3fe:d7c8:e0d with SMTP id z24-20020a05600c221800b003fed7c80e0dmr5342805wml.34.1695299930876; Thu, 21 Sep 2023 05:38:50 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:9af8:e5f5:7516:fa89? ([2001:b07:6468:f312:9af8:e5f5:7516:fa89]) by smtp.googlemail.com with ESMTPSA id c12-20020adfed8c000000b0032179c4a46dsm1650846wro.100.2023.09.21.05.38.49 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 21 Sep 2023 05:38:50 -0700 (PDT) Message-ID: <9d2cccad-16ee-abcf-5a34-7e513a050229@redhat.com> Date: Thu, 21 Sep 2023 14:38:48 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v10 33/38] x86/entry: Add fred_entry_from_kvm() for VMX to handle IRQ/NMI Content-Language: en-US To: Nikolay Borisov , Xin Li , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-edac@vger.kernel.org, linux-hyperv@vger.kernel.org, kvm@vger.kernel.org, xen-devel@lists.xenproject.org Cc: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, luto@kernel.org, seanjc@google.com, peterz@infradead.org, jgross@suse.com, ravi.v.shankar@intel.com, mhiramat@kernel.org, andrew.cooper3@citrix.com, jiangshanlai@gmail.com References: <20230914044805.301390-1-xin3.li@intel.com> <20230914044805.301390-34-xin3.li@intel.com> <8163cf98-8968-72a4-4193-1ca9f019d9ff@suse.com> From: Paolo Bonzini In-Reply-To: <8163cf98-8968-72a4-4193-1ca9f019d9ff@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 09:59:36 -0700 (PDT) On 9/21/23 14:11, Nikolay Borisov wrote: >> >> +SYM_FUNC_START(asm_fred_entry_from_kvm) >> +    push %rbp >> +    mov %rsp, %rbp > > use FRAME_BEGIN/FRAME_END macros to ommit this code if > CONFIG_FRAME_POINTER is disabled. No, the previous stack pointer is used below, so the code might as well use %rbp for that; but it must do so unconditionally. Paolo >> + >> +    UNWIND_HINT_SAVE >> + >> +    /* >> +     * Don't check the FRED stack level, the call stack leading to this >> +     * helper is effectively constant and shallow (relatively speaking). >> +     * >> +     * Emulate the FRED-defined redzone and stack alignment. >> +     */ >> +    sub $(FRED_CONFIG_REDZONE_AMOUNT << 6), %rsp >> +    and $FRED_STACK_FRAME_RSP_MASK, %rsp >> + >> +    /* >> +     * Start to push a FRED stack frame, which is always 64 bytes: >> +     * >> +     * +--------+-----------------+ >> +     * | Bytes  | Usage           | >> +     * +--------+-----------------+ >> +     * | 63:56  | Reserved        | >> +     * | 55:48  | Event Data      | >> +     * | 47:40  | SS + Event Info | >> +     * | 39:32  | RSP             | >> +     * | 31:24  | RFLAGS          | >> +     * | 23:16  | CS + Aux Info   | >> +     * |  15:8  | RIP             | >> +     * |   7:0  | Error Code      | >> +     * +--------+-----------------+ >> +     */ >> +    push $0                /* Reserved, must be 0 */ >> +    push $0                /* Event data, 0 for IRQ/NMI */ >> +    push %rdi            /* fred_ss handed in by the caller */ >> +    push %rbp ^^ here Paolo >> +    pushf >> +    mov $__KERNEL_CS, %rax >> +    push %rax