From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A210C2BB1D for ; Fri, 13 Mar 2020 09:12:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 033C82073E for ; Fri, 13 Mar 2020 09:12:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726559AbgCMJMZ (ORCPT ); Fri, 13 Mar 2020 05:12:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:45946 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726310AbgCMJMZ (ORCPT ); Fri, 13 Mar 2020 05:12:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 63F64AD39; Fri, 13 Mar 2020 09:12:23 +0000 (UTC) Date: Fri, 13 Mar 2020 10:12:21 +0100 From: Joerg Roedel To: Andy Lutomirski Cc: Joerg Roedel , X86 ML , "H. Peter Anvin" , Dave Hansen , Peter Zijlstra , Thomas Hellstrom , Jiri Slaby , Dan Williams , Tom Lendacky , Juergen Gross , Kees Cook , LKML , kvm list , Linux Virtualization Subject: Re: [PATCH 38/62] x86/sev-es: Handle instruction fetches from user-space Message-ID: <20200313091221.GA16378@suse.de> References: <20200211135256.24617-1-joro@8bytes.org> <20200211135256.24617-39-joro@8bytes.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 12, 2020 at 01:42:48PM -0800, Andy Lutomirski wrote: > I realize that this is a somewhat arbitrary point in the series to > complain about this, but: the kernel already has infrastructure to > decode and fix up an instruction-based exception. See > fixup_umip_exception(). Please refactor code so that you can share > the same infrastructure rather than creating an entirely new thing. Okay, but 'infrastructure' is a bold word for the call path down fixup_umip_exception(). It uses the in-kernel instruction decoder, which I already use in my patch-set. But I agree that some code in this patch-set is duplicated and already present in the instruction decoder, and that fixup_umip_exception() has more robust instruction decoding. I factor the instruction decoding part out and make is usable for the #VC handler too and remove the code that is already present in the instruction decoder. Regards, Joerg