Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp3970914iob; Mon, 2 May 2022 09:52:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz5UbEI2Kwu+vTx7HCV5gcz19NVPrs3D54mE6mAUGE7VwAvZ32PyiNY2d3O51cPqb2MpdJf X-Received: by 2002:a05:6512:3403:b0:448:5f92:7b0c with SMTP id i3-20020a056512340300b004485f927b0cmr9023611lfr.237.1651510368618; Mon, 02 May 2022 09:52:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651510368; cv=none; d=google.com; s=arc-20160816; b=PdErMMKmgpXRas72rvOwKM+eUX7p4ZsGCQ96pm2DbXolcd5oeAjQJdaRcbEV3z0TN4 K9nGJTj3laooseI+i8yIwVqsknVKI4AH2/4h46hB754fEgP6q4a/ee4EIBarfkKWcaGc TepDflcNCpq5VpivCzXV3IbcK0YONEPko1urYh0R94k8VN6zTrtQP4Xwi8xHi6ilrG0l H3jcqHgdnF1DTYBe0IP6ziSreh44U3Vegznw05D+r6xwPkhd2rW0dlEBmSOclqy47/wV nNX39y3P3wspA4pst5fjduQX6lQHBopPinqneBEFDc0sGfGLm0cYp66eQZym1r+xUHq+ suiw== 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=UDj5WuEkt2jbvnjpEjTkCXpcFNBSD6t6DGzm1raGCao=; b=0nxrUmgMQLLnMmV57s9g618Y1Em+ThhfTlytnhWaARmhsU+RN/mI43PzVXj9GvG201 Y32omhpp83Yz3L38c/t3XnZE3QYAv02q2/zjHFCfnhJjpksheD5BLMJt8rasj+Vo1oAY Sd9Wq5/KiaWye91KeAW8rAdmUqbuufPnRG0REsfBQPsKJu3LwQFMnMRFCg6zEmQaBDgK oSKrpW2otkx9+24bwN6yoGQIqcPiDVshm3R0/nnCGk/YbNu+P+8JYt/QHj6SaIuoI0+l VPgcNPcgcrJOAOYZMgMwL0dSEL7YXuzjcG7s3Kctbd29rkRveZUbGZsgjEMdpFtamYNi G89A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ScmS9EBV; 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 z22-20020a2e9656000000b0024b5a15e915si13069259ljh.316.2022.05.02.09.52.21; Mon, 02 May 2022 09:52:48 -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=ScmS9EBV; 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 S1359595AbiD2NsH (ORCPT + 99 others); Fri, 29 Apr 2022 09:48:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231211AbiD2NsG (ORCPT ); Fri, 29 Apr 2022 09:48:06 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ACB09CC505 for ; Fri, 29 Apr 2022 06:44:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1651239886; 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=UDj5WuEkt2jbvnjpEjTkCXpcFNBSD6t6DGzm1raGCao=; b=ScmS9EBVuLmK1vS8rYKhK6p/kSQu/JZgN8rZCinSaG762nk+3dd6QEhjvYM0dM5R7rgIIT KSVTLX4eqT73sMarEscBWNbWOvKW0JbJ6bw5UeU26Sky2tWFxZoq3oVz/wtdHQQLXvDHz5 2eMgSAho74nLBwpaKI7xH0j1k0x/oic= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-249-XZvc0YF1PkGd5Pjh6j2R5g-1; Fri, 29 Apr 2022 09:44:45 -0400 X-MC-Unique: XZvc0YF1PkGd5Pjh6j2R5g-1 Received: by mail-ed1-f69.google.com with SMTP id c23-20020a50d657000000b00425d5162a0dso4547422edj.16 for ; Fri, 29 Apr 2022 06:44:45 -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=UDj5WuEkt2jbvnjpEjTkCXpcFNBSD6t6DGzm1raGCao=; b=PjNxOz7mz5Pv56vmOtjnR5x1vx3BSNbb4AAKJmAO45rYU7LUBhH6p8jYNubGVWoqNn A7sowRjycFnlUbipTrl8wlUpN0l3zclfeXRubNKTDeGsy0RzAPJkCzHBzkqb/iAK16FG VuhjbQg80L3gx8guKiXn+oR/8WEhKGbqEBBD9zsKkdH4UEZepCIX1gmXZu8OZxPIrqV+ ZEj5mwZ6lm+XePEdf4TfcYW0QgP9RPgdqRsEk0yVty7ONk28eYaE9rRD36HpVYiMQjYf 3gsJxKmwlp7LvEfKqGhEhn+V6MkPkF2GkEbDBR/akdBPde0fSdBZg45DAN5hKL28Syx6 3Xog== X-Gm-Message-State: AOAM532wctFODdgRY/bjc8A3SQgaqtmPBbpxFjRVaeRyh3VMTXm0CsA8 VamtxI++8eF6ujJy9Noh3pr1rf5k+eax6bPgzyv12zYINDQ6ehl/1can2LGbnSOTQh/FrY5hPs9 aUjBJDVH5UtO1+9lg/DUsQnm8 X-Received: by 2002:a17:907:2bde:b0:6f3:8e91:3a60 with SMTP id gv30-20020a1709072bde00b006f38e913a60mr25351073ejc.434.1651239884320; Fri, 29 Apr 2022 06:44:44 -0700 (PDT) X-Received: by 2002:a17:907:2bde:b0:6f3:8e91:3a60 with SMTP id gv30-20020a1709072bde00b006f38e913a60mr25351062ejc.434.1651239884143; Fri, 29 Apr 2022 06:44:44 -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 og13-20020a1709071dcd00b006f3ef214e3fsm657851ejc.165.2022.04.29.06.44.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Apr 2022 06:44:43 -0700 (PDT) Message-ID: Date: Fri, 29 Apr 2022 15:44:42 +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> <20220429114012.4127-1-hdanton@sina.com> From: Paolo Bonzini In-Reply-To: <20220429114012.4127-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 13:40, Hillf Danton wrote: > To avoid acquiring more than one mutexes at the same time, add a completion > in paralle to the mutex in question and ask mutex locker for non-migration > purpose to take a nap on completion instead of mutex. Acquiring more than one mutex at a time is perfectly fine. It also cannot get into philosophers-problem-like deadlocks because 1) it's got a well-defined iteration order 2) it's protected by sev_lock_two_vms. Just, lockdep that has to be convinced that it is fine. I don't shy away from complex locking schemes if they're necessary, but here it absolutely isn't. Paolo