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=-8.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,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 AB5C6C433B4 for ; Tue, 11 May 2021 19:29:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 795576162A for ; Tue, 11 May 2021 19:29:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232090AbhEKTae (ORCPT ); Tue, 11 May 2021 15:30:34 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:33794 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbhEKTab (ORCPT ); Tue, 11 May 2021 15:30:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620761364; 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=U8VQQPkbOEAUOoAyHQFpuOhcMTPtNaQqkF/sYSE/zpM=; b=B/bIyXmmCG5jisfd8ld2Jy1J3qMRichwyBQTaMrcNrBmaB4Cnn0lZ2zN9VSC+qYGlSYdU1 9TII28oWI2RcFO5qUor/cf+kKFZvIk/62EP6x0fFMSlEWHiNVKKzRa+dxdUhOieoYpyKkV eafbQ53O0IJWk2cy2/hD6+lEs2X2fis= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-316-4GY_eSRMNymZtJWpLlRRSg-1; Tue, 11 May 2021 15:29:22 -0400 X-MC-Unique: 4GY_eSRMNymZtJWpLlRRSg-1 Received: by mail-ed1-f70.google.com with SMTP id g19-20020a0564021813b029038811907178so11462874edy.14 for ; Tue, 11 May 2021 12:29:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=U8VQQPkbOEAUOoAyHQFpuOhcMTPtNaQqkF/sYSE/zpM=; b=TgoRhOI4bxWiixI2LgMhDuOKQdE9UXMLg7RobedWUyhUJOepHwCR2I7AqNwX0uTWZ6 cI1z8BehBEQ7tBM7vU6oyhxaN4Jv98vmu7MPouJ767BSWDZECp3Zgx8TS0hUyEWLWBsh PZ7R7s7DrPQNa+HiguaqUzfi7HlwOvAD6DwB5x2pz/OrQ0lKzp7EzDtscuTttcsHinnq 4WAiCxKpdZvOI9keMtFc1DvCVsT+H1n4YscxlG6krIlK8f/f6Mq8kHGluJKxkOK2svMA sE4LhVcEUPaxNnopylE8hEoVxeaWMC2pZrWvW61V5ApvCoh1R4rnQulVaOdTMcyr0eby fumw== X-Gm-Message-State: AOAM5327Vn6sxCtsNP4Zjx7q6kx57GwsBW22UE7fQO0Uqt7LmWEAEQhh jK99EKULgHLO7DDO1/t49VH8EJpvkNZHkJdRzkLzvVQLhWtQfMSuGvHQnn9pksCcwBP95sIoMxn YpksS/YLFiQpuwD1+ylZleHzI X-Received: by 2002:a17:907:1181:: with SMTP id uz1mr33342235ejb.194.1620761361661; Tue, 11 May 2021 12:29:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz0Dx7qUS1VH55IC/UGrUERRS9i04SgOldQ9s1zOM6fqquzgDeHq4sdHSqIP00yWitAHY9XFw== X-Received: by 2002:a17:907:1181:: with SMTP id uz1mr33342216ejb.194.1620761361418; Tue, 11 May 2021 12:29:21 -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 u4sm1654908eds.1.2021.05.11.12.29.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 11 May 2021 12:29:20 -0700 (PDT) To: Sean Christopherson , Ben Gardon Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Peter Xu , Peter Shier , Yulei Zhang , Wanpeng Li , Xiao Guangrong , Kai Huang , Keqian Zhu , David Hildenbrand References: <20210511171610.170160-1-bgardon@google.com> <20210511171610.170160-5-bgardon@google.com> From: Paolo Bonzini Subject: Re: [PATCH v4 4/7] KVM: mmu: Add slots_arch_lock for memslot arch fields Message-ID: Date: Tue, 11 May 2021 21:29:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/05/21 21:21, Sean Christopherson wrote: >> + /* Released in install_new_memslots. */ > > This needs a much more comprehensive comment, either here or above the declaration > of slots_arch_lock. I can't find anything that explicitly states the the lock > must be held from the time the previous memslots are duplicated/copied until the > new memslots are set. Without that information, the rules/expecations are not > clear. Indeed, this needs basically a description of the races that can happen, as you explained them in the v1 review. > Unfortunately I'm just whining at this point since I > don't have a better idea Yeah, the synchronize_srcu call in install_new_memslots throws a wrench in most alternatives. Paolo