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=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 87072C433DF for ; Tue, 2 Jun 2020 13:33:07 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 44D9A206E2 for ; Tue, 2 Jun 2020 13:33:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="2EGajLxx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 44D9A206E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CB3F3280089; Tue, 2 Jun 2020 09:33:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C8B5F280081; Tue, 2 Jun 2020 09:33:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B7A07280089; Tue, 2 Jun 2020 09:33:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 9FDDE280081 for ; Tue, 2 Jun 2020 09:33:06 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 65034180AD801 for ; Tue, 2 Jun 2020 13:33:06 +0000 (UTC) X-FDA: 76884362772.18.taste42_725feac50381c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 4CBED100EC67B for ; Tue, 2 Jun 2020 13:33:06 +0000 (UTC) X-HE-Tag: taste42_725feac50381c X-Filterd-Recvd-Size: 4771 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Tue, 2 Jun 2020 13:33:05 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id o9so12600098ljj.6 for ; Tue, 02 Jun 2020 06:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UXOP6EeQeN7QnSWXWe4xWPi5EI/vGhngXSWL67O93vc=; b=2EGajLxxJM6gikQYPuS1mnKu5hp46+IVBEa9BwEc3owfe/BwQA7s9KI6hUKhvXWmSt iMTb3bx5tEj8Sg6M7mXe5jzbS8EczhnXojEdy5kqCDqyc08i+3JK6eu5RtkCnIjm3CyY bI4QHBWOVI7IQ5r9m0fg4tfoYV4jyp815xZStlLvA/SPqmTHBLzf1jYYzdTl/TDY+YKZ tQCVWR94HSbuE4z6qpl2vcGt6s4WI7kuo1H6tSS1vr1WOEbPHcyxvV1/7QcLvUVCP2FK xWa+SP7Rx1sAG/Sv1pXG9062JgPV+wc117DRdA0jPIqWflhSnelmPeh3mtb45eP9BUB3 /lxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UXOP6EeQeN7QnSWXWe4xWPi5EI/vGhngXSWL67O93vc=; b=cefBAFGX9EAtTPkTyLFeqGp5BhkXB+ElbN0ZgdSkrudvjPM0X3yW8a7zYjIP91ZcCo cmT/mqhA2JDadeft736wl9EHCd2TFBzEN+ryBz+EkHal/1a6+LDoVIIz5kXHwSIcYK7D +KcTT4fkhrv7SWJCSFc0cHIga31pIBTGTnivdzxvwSwjy1bB9T8GZpMnb4i8QMQ+VH30 2kzTswIfdkELymfBxMpNGLzJl3znAyZyWKLUv1th0zLQa2USL8FlqyZy1kpvIlNIROEw rs36D+rfiisse8m2hvPPk7Z9UW4ocemOkkxkBUnJm1eKnrEEc/pgQBdmB+iY4U4ANjn2 Ff8g== X-Gm-Message-State: AOAM531+X9zOY2f2hE/XC31LWfE2IIvFRvu9ko9HzdwAN634qwxdi6wi HWvlk1oapxpjtUAAp8ynMAKfuQ== X-Google-Smtp-Source: ABdhPJwUKdYFxoN2BZU6Td7Fn5skrnUDC3bo7r1I44uRR7y3Vo9hSYxz7kedhP7e5lIggogsjLYjGw== X-Received: by 2002:a2e:9859:: with SMTP id e25mr3590593ljj.243.1591104784267; Tue, 02 Jun 2020 06:33:04 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id y17sm696697lfa.77.2020.06.02.06.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 06:33:03 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 226B4102780; Tue, 2 Jun 2020 16:33:09 +0300 (+03) Date: Tue, 2 Jun 2020 16:33:09 +0300 From: "Kirill A. Shutemov" To: Paolo Bonzini Cc: Vitaly Kuznetsov , David Rientjes , Andrea Arcangeli , Kees Cook , Will Drewry , "Edgecombe, Rick P" , "Kleen, Andi" , x86@kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Dave Hansen , Andy Lutomirski , Peter Zijlstra , Sean Christopherson , Wanpeng Li , Jim Mattson , Joerg Roedel Subject: Re: [RFC 06/16] KVM: Use GUP instead of copy_from/to_user() to access guest memory Message-ID: <20200602133309.xyet6tndjadwafnb@box> References: <20200522125214.31348-1-kirill.shutemov@linux.intel.com> <20200522125214.31348-7-kirill.shutemov@linux.intel.com> <87a71w832c.fsf@vitty.brq.redhat.com> <20200525151755.yzbmemtrii455s6k@box> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4CBED100EC67B X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Jun 01, 2020 at 06:35:22PM +0200, Paolo Bonzini wrote: > On 25/05/20 17:17, Kirill A. Shutemov wrote: > >> Personally, I would've just added 'struct kvm' pointer to 'struct > >> kvm_memory_slot' to be able to extract 'mem_protected' info when > >> needed. This will make the patch much smaller. > > Okay, can do. > > > > Other thing I tried is to have per-slot flag to indicate that it's > > protected. But Sean pointed that it's all-or-nothing feature and having > > the flag in the slot would be misleading. > > > > Perhaps it would be misleading, but it's an optimization. Saving a > pointer dereference can be worth it, also because there are some places > where we just pass around a memslot and we don't have the struct kvm*. Vitaly proposed to add struct kvm pointer into memslot. Do you object against it? -- Kirill A. Shutemov