Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp4377957pxt; Wed, 11 Aug 2021 04:49:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyVYOBSjrKaZQEWLotnhLg0+zokumbu7Eb/Ns9G2Jz31l0x/mpIG1OjEDCfESdrXugzbp4z X-Received: by 2002:a92:d64d:: with SMTP id x13mr565538ilp.202.1628682573335; Wed, 11 Aug 2021 04:49:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628682573; cv=none; d=google.com; s=arc-20160816; b=i6yK5uKM/RJ2rTMVv8s/Zp7c3MHr1Yuz7+DG18MFenVhX69WlGcc0WVcie96N9VBfe 1WgLtdb8iw8CqOBJmOgxRKgAmvD83uAu1X7ILcF/GDtLJfUXliTlqFi0lYZUW5yo/jzs RAhpERJ0qMwIIZpBEC0Gyz1EjTUs7G17icz/+jZmnInla8IN/JC+ccZmGcHl3XnpoNqr V9Hv+KRn/yDoY+ACKnZtJGRTcYYzUJs8q735PURMIX4Y7mc1k+ZZMlBEM1I4NwURcznf 0Z2GwYaujfN4X6OG6qIoi/oxLCVcAuQA4lB0AiqRudhlVsxvf8PzEHqGMqU99coT0dqy xFzw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=BUoM+r7xLYH/eW2KKZORvWKAgZMeUfVXHNYLMtc9asU=; b=aq1zetDhUmpGNGXRSACKXDhAr+76Oo84lwlgqxQ1xSbQIS7tCjO5IVoSEuHs/P8U+q eboV9ffxJpfBcw7Ia8KX/6YAfQ0y/nEM1zQ5sEUNl5AjFis9aZBXv/HZ6FUlVih0CjZ1 CBzbhnMhDiB9wIhFwUMWxXX4IGNGGm/1hXSCTlhQe3yzTEm+6M0DyqI/TkL2FPFt4jpH 1nzUybBoEBRZmfCAcB9GFyJbz5t4e819H6J0C+yleOXen1TXT6WEmuwGpxPRmz9FPdWK SIXiFFh7njg/oTUjAxGw71NVIRKl5Wvm/SQcc8e+cZ+ojRQzCoATf7ihQhDFTR+1PfUt t+Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dfFfAXhS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h12si30744630ild.123.2021.08.11.04.49.21; Wed, 11 Aug 2021 04:49:33 -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=@redhat.com header.s=mimecast20190719 header.b=dfFfAXhS; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237330AbhHKLsO (ORCPT + 99 others); Wed, 11 Aug 2021 07:48:14 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28361 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236314AbhHKLsN (ORCPT ); Wed, 11 Aug 2021 07:48:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628682464; 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=BUoM+r7xLYH/eW2KKZORvWKAgZMeUfVXHNYLMtc9asU=; b=dfFfAXhSZTkfxHGLj6dkrYF9GL91fUKviFaC1EgdZyyCNTIHWc9e/hVduaaloUOC4asPOn lGoG7y7fz8ZHxQt2pp+YoXvcgtZZnDiNwI7m2iFHSfIMJpaITjESwFn5zTFC/42lSoq6vp socqMz4uxPUVgd5Elugefzw4Iq4XGB0= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-217-lUaMsTmzNiio811V46WqUg-1; Wed, 11 Aug 2021 07:47:43 -0400 X-MC-Unique: lUaMsTmzNiio811V46WqUg-1 Received: by mail-ej1-f71.google.com with SMTP id k21-20020a1709062a55b0290590e181cc34so582324eje.3 for ; Wed, 11 Aug 2021 04:47:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=BUoM+r7xLYH/eW2KKZORvWKAgZMeUfVXHNYLMtc9asU=; b=Y8rpBmUAcLQcF7BkOC9E51bN6Gv212XIXiPrnU5A46FmR+b3k3zhpxxCAJByCJWIdm OVrgGXanTybW051lr4N6rGQWd0I1VCLuqgMAwCmCXmGvrj1gXOF24puhuIq1xrajDULC G+ozCOFW54aukn32OAIufWzWWmzgAKylIy6HqpMGzbFLCtFEbVP3RhF5RBfda+5se3Ut aG+Ow49qlCZZcBF0SbaFgDhopoLpLlqut2KD1sxq57OSyJp0b0WllwN82MwP8buPqV3I v7bRdvThe2uY7/cTH4UiX3LSAzoGLDSucwz9GRlnZ9vGrqY4fK2N8cIiWSJTKbuyAdN1 IpPg== X-Gm-Message-State: AOAM530Zu/W6RrH0MvPJNDZ3nZmmaPZB9hb4B70NVS54/eRChzoxwbIb BxDAt7lta6+e4zkEsl0D165SmKSc2A3aldkpKXA/pHR8k+XF0xvLVbrETNS1nep5kFYXBrdVJYp FftDKPgLhVysM1K8iUFzSQyxx X-Received: by 2002:a17:907:7609:: with SMTP id jx9mr184739ejc.432.1628682462333; Wed, 11 Aug 2021 04:47:42 -0700 (PDT) X-Received: by 2002:a17:907:7609:: with SMTP id jx9mr184726ejc.432.1628682462190; Wed, 11 Aug 2021 04:47:42 -0700 (PDT) Received: from ?IPv6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.gmail.com with ESMTPSA id o23sm11172664eds.75.2021.08.11.04.47.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 11 Aug 2021 04:47:41 -0700 (PDT) Subject: Re: [PATCH 1/2] KVM: x86/mmu: Protect marking SPs unsync when using TDP MMU with spinlock To: Sean Christopherson Cc: Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Ben Gardon References: <20210810224554.2978735-1-seanjc@google.com> <20210810224554.2978735-2-seanjc@google.com> From: Paolo Bonzini Message-ID: <74bb6910-4a0c-4d2f-e6b5-714a3181638e@redhat.com> Date: Wed, 11 Aug 2021 13:47:39 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210810224554.2978735-2-seanjc@google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/08/21 00:45, Sean Christopherson wrote: > Use an entirely new spinlock even though piggybacking tdp_mmu_pages_lock > would functionally be ok. Usurping the lock could degrade performance when > building upper level page tables on different vCPUs, especially since the > unsync flow could hold the lock for a comparatively long time depending on > the number of indirect shadow pages and the depth of the paging tree. If we are to introduce a new spinlock, do we need to make it conditional and pass it around like this? It would be simpler to just take it everywhere (just like, in patch 2, passing "shared == true" to tdp_mmu_link_page is always safe anyway). Paolo