Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4923576rwb; Mon, 31 Jul 2023 14:53:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlGxCQlcQ2GHJ6SnWgJr/199OeBYICrnahP9aeI90Pmh2/DOYr9GvAUMJyjDbtia+d+IS40/ X-Received: by 2002:a05:6402:510e:b0:522:c226:34ea with SMTP id m14-20020a056402510e00b00522c22634eamr1058088edd.7.1690840401050; Mon, 31 Jul 2023 14:53:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690840401; cv=none; d=google.com; s=arc-20160816; b=ufGypAKV455hZSfPpUfbXv+aLxmcmSyfPNtuA2v3d3H9XmvPwXAF1IygghO5wZh0qO 5iXSvj5+j1ckmpWcvsJ57YZwcmBR76izs7ICvljRnmzC7Ynqwn6KGfyNjE/gOfklU+EG iaU2mqgHM9KC+BGH8TeSxoWhkx+2ByqYjVbOdxsA/o7ujg+MDnUiDc+W+qgAjV6z+nkp vQAQKzdKSolLgIC4BA65bMim6H0D+eJstQ/yybQ+UKbE56x0/y+8CABoPHcR96P/sCV9 IzQQZ+fVecE3QT/WHJSUh/VkLLUeptqAvD+pwcNFfMVpKsLQj7Z1L1vG1NoOjxV0ui/b 0QlQ== 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:dkim-filter; bh=Hg2XSL3316ANoXYXjd63x+cCNIVtiqBW14cv6sKLqfM=; fh=2TRcqpsbgUGLR1ahq3dK7xqs7B18sMuBPw7269aOJyk=; b=APXHIQrh32LHX6lEyyYEglBLsDL+NYXL51WGvlf/TXCgJhmZdTp73NgnFP6JPi6JmF G8C+8Y+v24AQDRf/4IPkJvkvlhaYrK5DO4DnznOlRE6rYvYmN7bUpPzKIDUJ558sUZPY zeG6IsaV6C3UkCbiyNftgbJyCvQTd4G8pCjQ7/tmntNi1JHUohUHgYSWeyYRa8A+ay2A gI47A6apI3o6rTqWqqJ/b5Mt4l4lflZ7BUIPqCoqKd7RZaCqTtGk0GiGrbzlIAsip2SQ MeJd3tIuk9YGoXM8V49Rk+yX1rThgkEWDtTGyAnlhqL2G1ZALntcCuPgWCA6ZAfB7srX DuQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2023071101 header.b=OJyzPW65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020aa7d60f000000b0051e0d7a3fc9si7323502edr.37.2023.07.31.14.52.51; Mon, 31 Jul 2023 14:53:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2023071101 header.b=OJyzPW65; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231479AbjGaVrq (ORCPT + 99 others); Mon, 31 Jul 2023 17:47:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbjGaVrp (ORCPT ); Mon, 31 Jul 2023 17:47:45 -0400 Received: from mail.zytor.com (unknown [IPv6:2607:7c80:54:3::138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C174114; Mon, 31 Jul 2023 14:47:43 -0700 (PDT) Received: from [192.168.105.249] ([75.104.94.137]) (authenticated bits=0) by mail.zytor.com (8.17.1/8.17.1) with ESMTPSA id 36VLiSLD3093143 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 31 Jul 2023 14:44:34 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 36VLiSLD3093143 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2023071101; t=1690839952; bh=Hg2XSL3316ANoXYXjd63x+cCNIVtiqBW14cv6sKLqfM=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=OJyzPW65vrM8sDH6eNGy+5kWbcB7PMYBpzWhQpIWkaAZClwYLyiR8q3r0h24DHa+i plc1tYwGV1X0jnVZoHyMcH21g4d3T5nrZNciwkD9pXyPp9eyd7deKj5//687qepUUN GajcQAPfiwt5T7KF3w3EDPjhuU+UOb+SXF0Ey3xPLdCdh2vlXfVnIDfD1LR2iQn1Q3 +p5bLyY/BkC4u9rExXSQvakREpl4pn+K6rV/GzfnNnDvo8xR1x7/0XAWYi0JZGxsUi 6sYcbHmh6hzcml78uw2uhAQKsHCzb+/6sFfciH7vXjmIcsvNRtd0H0JUkcPZnEheRh J+lI/W952JXBg== Message-ID: <4ccbf0e9-716d-dfe0-537c-210e5455418c@zytor.com> Date: Mon, 31 Jul 2023 14:44:20 -0700 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 v9 29/36] x86/fred: FRED entry/exit and dispatch code Content-Language: en-US To: 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: Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Andy Lutomirski , Oleg Nesterov , Tony Luck , "K . Y . Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Sean Christopherson , Peter Zijlstra , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Josh Poimboeuf , "Paul E . McKenney" , Catalin Marinas , Randy Dunlap , Steven Rostedt , Kim Phillips , Hyeonggon Yoo <42.hyeyoo@gmail.com>, "Liam R . Howlett" , Sebastian Reichel , "Kirill A . Shutemov" , Suren Baghdasaryan , Pawan Gupta , Jiaxi Chen , Babu Moger , Jim Mattson , Sandipan Das , Lai Jiangshan , Hans de Goede , Reinette Chatre , Daniel Sneddon , Breno Leitao , Nikunj A Dadhania , Brian Gerst , Sami Tolvanen , Alexander Potapenko , Andrew Morton , Arnd Bergmann , "Eric W . Biederman" , Kees Cook , Masami Hiramatsu , Masahiro Yamada , Ze Gao , Fei Li , Conghui , Ashok Raj , "Jason A . Donenfeld" , Mark Rutland , Jacob Pan , Jiapeng Chong , Jane Malalane , David Woodhouse , Boris Ostrovsky , Arnaldo Carvalho de Melo , Yantengsi , Christophe Leroy , Sathvika Vasireddy References: <20230731064119.3870-1-xin3.li@intel.com> From: "H. Peter Anvin" In-Reply-To: <20230731064119.3870-1-xin3.li@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 7/30/23 23:41, Xin Li wrote: > + > +static DEFINE_FRED_HANDLER(fred_sw_interrupt_user) > +{ > + /* > + * In compat mode INT $0x80 (32bit system call) is > + * performance-critical. Handle it first. > + */ > + if (IS_ENABLED(CONFIG_IA32_EMULATION) && > + likely(regs->vector == IA32_SYSCALL_VECTOR)) { > + regs->orig_ax = regs->ax; > + regs->ax = -ENOSYS; > + return do_int80_syscall_32(regs); > + } We can presumably drop the early out here as well... > + > + /* > + * Some software exceptions can also be triggered as > + * int instructions, for historical reasons. > + */ > + switch (regs->vector) { > + case X86_TRAP_BP: > + case X86_TRAP_OF: > + fred_emulate_trap(regs); > + break; > + default: > + regs->vector = X86_TRAP_GP; > + fred_emulate_fault(regs); > + break; > + } > +} > +