Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1775619iob; Fri, 29 Apr 2022 12:33:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxxuHQM6n8BC7uobvlLRB0Vlc8iQqHNunWCyfi6tTSf5ztzpWQPbf/C85e6J6tcaM6TUxGp X-Received: by 2002:a05:6512:32ca:b0:472:921:a806 with SMTP id f10-20020a05651232ca00b004720921a806mr524274lfg.135.1651260794246; Fri, 29 Apr 2022 12:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651260794; cv=none; d=google.com; s=arc-20160816; b=dWLhdZ4jq9N+/S+n5mcqAYEYF3Dm5pSl5nhBa6LuBt+SPdsccPPSRhImTL6f6uKSYr GgXJ1nkpj5+6qHa7Nieoc/hF778swd/1KMji2FILzfE56+rDHPQgUc/apyDaheAoAJK8 Wa9GdZOfIln7LEl8/a0pLyeeeCn/mz3VZyKtUmZA/rfgGNden4r2a+5ito3dQP5BOPZP ctdV9Oq8+mKCyqONL/pEt4a+rPIEehj2i7Ufi6RYqQgwhU3Md27AyslCzEpwcg20+MCj 80/JcEOyRI8g0k89TYSDgiD5gbeLHzDLqBtkPNyBWdZpuW8REO2fFzeDu7IzijCMTZes Ktdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=j44ABfQoLltxcMt0c2HfidhVNagQghr3QdYc0SH5ZHg=; b=KOWNrqdYU8Y80lmhDR3eqRF2Umfv/H7BQ/iDKJU1Pi4/iYW3rNCWNQdvboDJvFXISQ i7IUgIAsMqaLarefHaq/5dP29wDvHLept/HXM/rBB3ehA12ISWKiaLpAQZ1xshaCgtNy F8D+XB3YM3/+Ont6y1V3RglPcWv40M/vbqghmTqzo+RWGnl28uWGNSC1zYjMlwp/xnDf 2Yp9dqhSCJ/EWEgX3y6r5uMJe4DP+3IErrS7M49VXVGVpIKDQWf+CYbsRD4pIMXz16Xg s3hWPgf/ee8Urpofv6B2x/dZFAVCo/zoAj8r4PYAt1cYt2JuTQsHTX9D/DTdWALrHCVs ljSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aaU2yu1y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p10-20020a2ea40a000000b0024b6b6d4e8csi7551897ljn.34.2022.04.29.12.32.47; Fri, 29 Apr 2022 12:33:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aaU2yu1y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1356111AbiD2Ivx (ORCPT + 99 others); Fri, 29 Apr 2022 04:51:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234027AbiD2Ivw (ORCPT ); Fri, 29 Apr 2022 04:51:52 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 17492C4010 for ; Fri, 29 Apr 2022 01:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651222112; 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=j44ABfQoLltxcMt0c2HfidhVNagQghr3QdYc0SH5ZHg=; b=aaU2yu1y2wAOknin+zcreQdH4ZbJX3FaLm1LjuS+1eYmelMnKQbY7q1ZJ4z9gQtZXxvpxl CFspRdqrf5GEQ8N3zQ4AlYKW8SOfNKEgB06Nl2Gk3yGk3EN0fbMxnmO0PwH9CD3/SRaGvo sa/GnivYup51zhdQpl7yFXJzIRVjXek= Received: from mail-ej1-f70.google.com (mail-ej1-f70.google.com [209.85.218.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-158-2rGHZFm4NjWyuoppjk-Wnw-1; Fri, 29 Apr 2022 04:48:30 -0400 X-MC-Unique: 2rGHZFm4NjWyuoppjk-Wnw-1 Received: by mail-ej1-f70.google.com with SMTP id o8-20020a170906974800b006f3a8be7502so4212847ejy.8 for ; Fri, 29 Apr 2022 01:48:30 -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=j44ABfQoLltxcMt0c2HfidhVNagQghr3QdYc0SH5ZHg=; b=Iq9/NcZDQgv0ZyU1TjpC2SWSR70SNxHz1POQkQN/imgCv6BOaTLxBs5PWhM+tTZ699 l5nYVaP8iZMbDA2ugooOAMkR0oyVBXuVk67w35CA9i/vW6KCzhrsIlPCgeOA816m0CJx DqoHn36eWnZvpzZ4B3xNFYiYcYPotqqrBOI+tbabclU0fRqI2ipl1IoUnthMA9HZwf5/ zxNxWyDT0+OBung1fm0i0UvTrPqTSph8aJ38PQS7qXNpXfW5rfH153nx6hg9KCUQwiUm 7HqCZRydlPqTfUuK/6NjpcLhuk4ARRIYQqObvv9k94hK3pnenm/n3HirZsfyncdx1oDk I/Pg== X-Gm-Message-State: AOAM53261gYLPjNKJiLrpcLgs9D2+7Ve0YDp271ex3Yua6RW7RcSfZ1o Ceq8vYvzeaSbOwjWqd7VD458+spT/vSrs17+tMgTa7eQvXDD9JYPdG69BF3iaokwe66swmqZTOn OsdV6DexFLrN/DqGxUVv8LX6i X-Received: by 2002:a17:907:868c:b0:6f2:d939:630c with SMTP id qa12-20020a170907868c00b006f2d939630cmr32630761ejc.211.1651222109337; Fri, 29 Apr 2022 01:48:29 -0700 (PDT) X-Received: by 2002:a17:907:868c:b0:6f2:d939:630c with SMTP id qa12-20020a170907868c00b006f2d939630cmr32630744ejc.211.1651222109148; Fri, 29 Apr 2022 01:48:29 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:1c09:f536:3de6:228c? ([2001:b07:6468:f312:1c09:f536:3de6:228c]) by smtp.googlemail.com with ESMTPSA id e13-20020a170906844d00b006f3ef214dc3sm434320ejy.41.2022.04.29.01.48.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Apr 2022 01:48:28 -0700 (PDT) Message-ID: <0cfb1f41-381f-6621-0fe7-14a54059a90d@redhat.com> Date: Fri, 29 Apr 2022 10:48:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Subject: Re: [PATCH v3] KVM: SEV: Mark nested locking of vcpu->lock Content-Language: en-US To: Hillf Danton Cc: Peter Gonda , Sean Christopherson , LKML References: <20220407195908.633003-1-pgonda@google.com> <62e9ece1-5d71-f803-3f65-2755160cf1d1@redhat.com> <4c0edc90-36a1-4f4c-1923-4b20e7bdbb4c@redhat.com> <20220429010312.4013-1-hdanton@sina.com> From: Paolo Bonzini In-Reply-To: <20220429010312.4013-1-hdanton@sina.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/29/22 03:03, Hillf Danton wrote: > Wonder if local lock classes [1] help. > > [1]https://lore.kernel.org/lkml/165055518776.3745911.9346998911322224736.stgit@dwillia2-desk3.amr.corp.intel.com/ No, they wouldn't. Local lock classes are more of a per-subsystem lock, while here the issue is that we are taking an arbitrary amount of locks at the same time. Technically it would be possible to put a struct lock_class_key in struct kvm_vcpu, but that wouldn't scale and would actually _reduce_ the likelihood of lockdep reporting bad things. The effectiveness of lockdep comes exactly from using the same map for all locks in the class, so that AB/BA scenarios are caught throughout the whole life of the system. If each lock has a separate they would be caught only if the "B" is exactly the same mutex in both AB and BA cases. Paolo