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 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6549FC433EF for ; Wed, 13 Oct 2021 15:12:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F257610E6 for ; Wed, 13 Oct 2021 15:12:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232444AbhJMPOb (ORCPT ); Wed, 13 Oct 2021 11:14:31 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:33468 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232118AbhJMPO3 (ORCPT ); Wed, 13 Oct 2021 11:14:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634137945; 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=jevHWv3I+jeDgbOR89zqbg54Wz1Hnd03eixogAhyAP0=; b=RUNB3fxMmDUd8jwcvvzgGtgsdN2uHG+dM5vE4RmivGKe/wq1s+MCjqmGW1qLCTR39qSlCS PbA4QRFVMOEtcOvXqTUtibeJz9Q6NxJ/K1uYupoX8vDaPWvSTuSSqE1tMNJN87aUE8Dzgo yI1H0p9cROTD2+hE6cBz8Dd5JEEJuXk= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-565-bCW9-sYDOZOm3wCelf4nOg-1; Wed, 13 Oct 2021 11:12:24 -0400 X-MC-Unique: bCW9-sYDOZOm3wCelf4nOg-1 Received: by mail-ed1-f69.google.com with SMTP id r11-20020aa7cfcb000000b003d4fbd652b9so2516277edy.14 for ; Wed, 13 Oct 2021 08:12:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=jevHWv3I+jeDgbOR89zqbg54Wz1Hnd03eixogAhyAP0=; b=oumsLtDF6q6OoxFCsUQ+0b3CLCoXoczoNx3YUksz4t/Od/8DT9sSxMezWTYvlV+Bfg ji9kxM/GYeR2gQpUvOeg+T5dlNYG/mSYbqgggxsQSNVj+ymWGMbtJKak6XCCWRlJ0owR +ZzlkYRpypCJUkCAC4Pzw3YBCEmiNeuB6Cj8NNZXvcnbs/dLYftn2V4VQvOLsD4fkVkK TqN99go5CRNiiP1OfCK2CXBeDCaY1/rQM1QHTAI9wd2BBnAI173tGk0mcPHTvdWsNyti sG3mWkayz2O+injndsfoiPW7RU3QaL47iTvUA9n2mGBx3X/1/5xsh4XqiUCvGa/0Wk3O XMbw== X-Gm-Message-State: AOAM531LG4YevacOQRH5AzEMsjDQxCzwHRTo8EOxS8iAHh2uGQzmWMP1 pdBAuqZMHde2DZyNkCgd33rcK9n73hHUoHR2GIFn9K/hMJ1llWSwQa6x3/Z/Qy08qi5/eL+K9nN ZRRJXSATMCWR1tbx6Di3746Bd X-Received: by 2002:a17:907:1dd2:: with SMTP id og18mr41272ejc.267.1634137943374; Wed, 13 Oct 2021 08:12:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwae9xhG7EGdZA2V4vnuNuXRMDzZv0Q1hHuqm+C+/4peepodprFKI0tHKPW8yWjmmtYrS29Qw== X-Received: by 2002:a17:907:1dd2:: with SMTP id og18mr41244ejc.267.1634137943141; Wed, 13 Oct 2021 08:12:23 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id y4sm6907507ejr.101.2021.10.13.08.12.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 13 Oct 2021 08:12:22 -0700 (PDT) Message-ID: <9adb43fb-182f-dffb-1fde-ae7e9610a344@redhat.com> Date: Wed, 13 Oct 2021 17:12:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 Subject: Re: [patch 14/31] x86/fpu: Replace KVMs homebrewn FPU copy from user Content-Language: en-US To: Sean Christopherson , Borislav Petkov Cc: Thomas Gleixner , LKML , x86@kernel.org, "Chang S. Bae" , Dave Hansen , Arjan van de Ven , kvm@vger.kernel.org References: <20211011215813.558681373@linutronix.de> <20211011223611.129308001@linutronix.de> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/10/21 16:57, Sean Christopherson wrote: >>> +int fpu_copy_kvm_uabi_to_vcpu(struct fpu *fpu, const void *buf, u64 xcr0, >>> + u32 *vpkru) >> Right, except that there's no @vcpu in the args of that function. I >> guess you could call it >> >> fpu_copy_kvm_uabi_to_buf() >> >> and that @buf can be >> >> vcpu->arch.guest_fpu > But the existing @buf is the userspace pointer, which semantically makes sense > because the userspace pointer is the "buffer" and the destination @fpu (and @prku) > is vCPU state, not a buffer. > > That said, I also struggled with the lack of @vcpu. What about prepending vcpu_ > to fpu and to pkru? E.g. > > int fpu_copy_kvm_uabi_to_vcpu(struct fpu *vcpu_fpu, const void *buf, u64 xcr0, > u32 *vcpu_pkru) > It doesn't matter much that the source is somehow related to a vCPU, as long as the FPU is concerned. If anything I would even drop the "v" from vpkru, but that's really nitpicking. Paolo