Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3520122pxb; Mon, 4 Apr 2022 19:42:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMRGL5QdFx0+flxXD8Pn68IvZ+yRENeBh661r1a+nX89eoL9uFWVXz6uXmsnlU66wxOv3L X-Received: by 2002:a05:6a00:27a2:b0:4fa:e893:bb68 with SMTP id bd34-20020a056a0027a200b004fae893bb68mr1180261pfb.82.1649126537210; Mon, 04 Apr 2022 19:42:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649126537; cv=none; d=google.com; s=arc-20160816; b=gI5IslN0U9WmeMO1T5ivxvFsXhlCerOsAxeUxCvEqiXjium5LS7KYl4ubnpxUORQ1r y1P3yPn+pkP9Btb2mdng+R+PX//BRAlf6GsLdrPs7tyXbA724MuPJ7mDJoHkxtkO4w18 DmYBoUiLsdXe/jChBhO1rUm4Ic94HSrrk/K03CShQP9AiKFnaEFtaEVNwD8KJCVtM2SQ O8B71L95QKkPLfFxNxi7ZGXMLNObcWw0TVIfKkPscq2yUqwgpewPVKL2hdxrbopb6mRo P3eyQNakRUVMMB7WflWyNx1Dx/SUORrfsL9S72rE0qTPVOVJVCc3LCuaGPVqMB2MsOxl S6Pw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=NUAR6ohw0c+cB2iG3OTNJ9/QNM3sctZv6ga716kg9Qs=; b=bbv2szCTUcYaSuDl2XVfELE+ilZ97jxh4dUsm4COGjm5kzWHzWBitZrpXIp+3Zus18 8ElggqQKciWmnpP/KBVprlXMCg/iUcu83yNBH8jmSGeU2qUpL67u3kKJw4szpSqPAEVP H/GSkjzbEcdtG9mts8CpOSxxZaXbJbQVi2ASABMMIDph30YGTYnpUjG0AxJ6rjqNWqkw 9H/+u+JXoWvJyrBXWGhft05uXUtvuXzjsRJulMY4nN4196iYGSvQN8fJmlK1u4m2cd7i MtI3xk1Nt72kI6N9j0CIDOXD2njXZtfBVBScZRJwOgkJ4/Yu8rW6Sznd/MWkHr0665wg /2Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="CiI/2hwL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p6-20020a170902e74600b001569eedd2dasi5752051plf.408.2022.04.04.19.42.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 19:42:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="CiI/2hwL"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 363D84EA09; Mon, 4 Apr 2022 18:05:52 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243876AbiDDWax (ORCPT + 99 others); Mon, 4 Apr 2022 18:30:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244432AbiDDW3S (ORCPT ); Mon, 4 Apr 2022 18:29:18 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3C2B340C3 for ; Mon, 4 Apr 2022 14:51:40 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id p15so19805915lfk.8 for ; Mon, 04 Apr 2022 14:51:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NUAR6ohw0c+cB2iG3OTNJ9/QNM3sctZv6ga716kg9Qs=; b=CiI/2hwLVlzRwZmZQ24QW/virYnoTO28HHhkZCPbk0q70mPEbPm5thEzkvoCzzbBdR sh5buC1GVITJxV/Ll7JbCxKFfrqRSPZWO8H5mSof7BuhT19cEgNIyM5O+NTgxRLmy6lg a8Xm7KzIvEwFLoiJFB5BYunyw1eSAekwAsH+Cmc7LauP9ou8IXcbTK44QQwoAIN7WBA0 5QscXUIFiiY6/fI5iznyG2p/G6tKvqdU51KHD4ajgv1PquooV3tl5pV0TQhVe25MkFWR rQnuoZAHO7EPnGmTwyjy14SNV1861P0Wvx+e879uSCS5VPOTH2xjN14mcZpJUHwQqUJO Svhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NUAR6ohw0c+cB2iG3OTNJ9/QNM3sctZv6ga716kg9Qs=; b=fIbZf2+YTFyGeVEg7dXNPaIo9+Gqgqqh75vHtUU/j5QIvyJIeB4yche+XiKLL/e8MD MgGGzlrZjQaZMeq9x17879hH4cXwAlHqM/C56/efbtAyp/xMtvqSUBelq/4OEl5s77jm Pl2MNqlF+fD+ioq1Zn0Gmpk3cd/d1X1TEeZVGQ/EBizIC6nEv+L0qAyiONSr9hLdY2+K xXKss4PoamfWEkcPE7g/Mvd3LVQbzE4M+QhzKfxgfMafqCX0Xr+Ap+dg41nYH9kpftu0 rJe1iztRidG7VAddnumwJe+89asQtUjzjoqrx10Q6Nu6+epGufhogNCmNMpCEMQk98H3 a66w== X-Gm-Message-State: AOAM530WnOx/8CMfiUefmkcveTSkOxx4/CzN8iGs78awUsb8Pm5knRA2 s/cgLohNXzu4kMvmnkTHaGlTsGL47M8mOVJfi+FAMQ== X-Received: by 2002:a05:6512:131b:b0:44b:75d:e3d0 with SMTP id x27-20020a056512131b00b0044b075de3d0mr252146lfu.685.1649109098578; Mon, 04 Apr 2022 14:51:38 -0700 (PDT) MIME-Version: 1.0 References: <20220404194605.1569855-1-pgonda@google.com> In-Reply-To: From: Peter Gonda Date: Mon, 4 Apr 2022 15:51:27 -0600 Message-ID: Subject: Re: [PATCH] KVM: SEV: Mark nested locking of vcpu->lock To: Sean Christopherson Cc: kvm list , John Sperbeck , David Rientjes , Paolo Bonzini , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 > > This is rather gross, and I'm guessing it adds extra work for the non-lockdep > case, assuming the compiler isn't so clever that it can figure out that the result > is never used. Not that this is a hot path... > > Does each lock actually need a separate subclass? If so, why don't the other > paths that lock all vCPUs complain? > > If differentiating the two VMs is sufficient, then we can pass in SINGLE_DEPTH_NESTING > for the second round of locks. If a per-vCPU subclass is required, we can use the > vCPU index and assign evens to one and odds to the other, e.g. this should work and > compiles to a nop when LOCKDEP is disabled (compile tested only). It's still gross, > but we could pretty it up, e.g. add defines for the 0/1 param. I checked and the perf vCPU subclassing is required. If I just only use a SINGLE_DEPTH_NESTING on the second VM's vCPUs I still see the warning. This odds and evens approach seems much better. I'll update to use that in the V2 unless there is a better idea.