Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp269567pxb; Thu, 2 Sep 2021 03:54:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+uAq/dhlA4c5ShUBDGxzJG1eN2WtmVK4JwAXAjXXMjiS2HEDeipURVNWiP4jJbbpInlQD X-Received: by 2002:a17:906:8399:: with SMTP id p25mr3077675ejx.449.1630580048964; Thu, 02 Sep 2021 03:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630580048; cv=none; d=google.com; s=arc-20160816; b=J5mf3aqX+QO8L/ao8NwvpeSejjtYC/V0tvxlxngDLZ85JHo7adpb+k5ueanVBgOhin xbCs+Eu1V7g7rM60NCRI1HMpSQfy5MKjsnkf9tUc6GtS42uRoRs04LSNV8xirKP/JAN6 idLGACb/5F2uflub2r4knWgMkXbKCVg/ZJ767LNaxQA1fPYQu+kv5dKAMulKblaL1HHD tMk7FtQOzJzukEfwk1elAZEj/DxvIwiI1NTaCcyOaP8jSj9RzQnvGj8g5LBaIoYk58Us wNOXDOyBARj2hTONi64NFnG3Ky45lns3yfgEWPAp4JOvS5+X6wWwNLJSIR5EBtvKrTIh pa+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hSXBOO+IhYekR6dWOzJNmWSb5Ms7mb6kt3x7AvComFM=; b=NgJcWM8j6gDgNuEIaqfGpUdf+rPEn/CcIxeMAMbc43aRo2PTP7F4Rk4U7GL5ApixN9 JHr2aX7+S+dZi/weuSQ5GvrBv1sKa82JeaPdA2r5tZN7yM/7QJMnDOyFGMEHdJbAoUAq uqqDExgDbqQ5J9cjZ8P/mqQOXBJQiTnlHRn5Brg9SxpUb4Wg6WYeOUbqLSgYgGm+vNuo mywXLt/hR2UoxutkGnN3bmftYcpkFpPr7xLu1cve70EepG9F/aNtqKJtUu/1jDjM7O+M 5eoC5SowKzm931mlk4e7goFN1aC46hHPUqtxPIHtHM6A9VBqhVzf8T0pikMvuY2yZdZe fTEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=eOo0Q11q; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h8si1557673ejj.422.2021.09.02.03.53.46; Thu, 02 Sep 2021 03:54:08 -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=@infradead.org header.s=desiato.20200630 header.b=eOo0Q11q; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236589AbhIBKSA (ORCPT + 99 others); Thu, 2 Sep 2021 06:18:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240160AbhIBKR7 (ORCPT ); Thu, 2 Sep 2021 06:17:59 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55582C061757 for ; Thu, 2 Sep 2021 03:17:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=hSXBOO+IhYekR6dWOzJNmWSb5Ms7mb6kt3x7AvComFM=; b=eOo0Q11qJRuSuvby/5TbqaJjP2 vunrDMHLbEbfYUpHYLHtDhW1KWFQAMWA43YOks9BSU8Wefw5ar8LCjs+0Sg6mL8snxgQlL+aMwn2o JktuCzRvXep42Yffb/lAUfKNrze+Xa6R4XMSOvLZGH1ozY4L4gH6JDuHgHn8CQhd3X/e/lkQI2TmM AsXPaFPpadPtWhCWG9AHVYhOF87E6Aabja3BLnwS5QqEsB9qI/nIpJf976qAFLgosmLFe7aR+wz// XJy71W+z0LZiaCekYW3CaGiB8Obbqpkm+qV/A1yYgUUBtSTEkQ9CfTTrBrLh6D+PRDGZdKb7PrlOE 3XWZ3aGQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mLjlq-0006KW-R4; Thu, 02 Sep 2021 10:16:37 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 87981300332; Thu, 2 Sep 2021 12:16:35 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6FFDB285E114E; Thu, 2 Sep 2021 12:16:35 +0200 (CEST) Date: Thu, 2 Sep 2021 12:16:35 +0200 From: Peter Zijlstra To: Lai Jiangshan Cc: linux-kernel@vger.kernel.org, Lai Jiangshan , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Joerg Roedel , Youquan Song , Tony Luck Subject: Re: [PATCH 11/24] x86/entry: Replace the most of asm code of error_entry to C code Message-ID: References: <20210831175025.27570-1-jiangshanlai@gmail.com> <20210831175025.27570-12-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210831175025.27570-12-jiangshanlai@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 01, 2021 at 01:50:12AM +0800, Lai Jiangshan wrote: > diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S > index 42d2918f5646..bc9e2f5ad370 100644 > --- a/arch/x86/entry/entry_64.S > +++ b/arch/x86/entry/entry_64.S > @@ -972,83 +972,14 @@ SYM_CODE_START_LOCAL(error_entry) > cld > PUSH_AND_CLEAR_REGS save_ret=1 > ENCODE_FRAME_POINTER 8 > > popq %r12 /* save return addr in %12 */ > movq %rsp, %rdi /* arg0 = pt_regs pointer */ > + call do_error_entry > movq %rax, %rsp /* switch stack */ > ENCODE_FRAME_POINTER > pushq %r12 > ret There's only a single error_entry callsite, which is idtentry_body. One of the things I wanted to do is change this lot so we change to the task_stack in 'C', using an adaptation of call_on_irqstack() and basically don't return frrom C until we're done with \cfunc. That is, once we call C, stay there, and don't do this back and forth between C and asm. As is, the resulting asm in error_entry is somewhat confusing given that we sometimes don't actually switch stacks.