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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92E62C433EF for ; Fri, 29 Apr 2022 13:44:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1376257AbiD2NsH (ORCPT ); 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-Google-Smtp-Source: ABdhPJwUW/EpO7oevKVE1vHoaxwIgCgKphIKNbFx7+URDUEXgds63INrXzLAMgs5yfMhCApWQxOrug== 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 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