Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp3764196rwn; Sat, 10 Sep 2022 20:23:42 -0700 (PDT) X-Google-Smtp-Source: AA6agR7F61v0YjxlzLVRhHym0vYni7IVFv2h4giKS1JBUJtWqeL65P4vXWYoJEQxWK+xOgB8FR0u X-Received: by 2002:a17:907:1dd7:b0:771:7257:2a06 with SMTP id og23-20020a1709071dd700b0077172572a06mr12550206ejc.319.1662866621853; Sat, 10 Sep 2022 20:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662866621; cv=none; d=google.com; s=arc-20160816; b=oFMFwhZWk+2EYdGwCWOqrLJyds5uTqKZgNbMC9xg7929N24/pVGFVy9v8Aq7zVGiEj b2LxBGwO1fXqxRIKuhXCj52sc1miPZoQT30o1O3V1Au4BfIedNLQVBjuR0byqj/lTH2W c2cdxki0eIYZah+loOsVaYMyL7AGhHYoCZ6nPsBBmO4VCCuwuRj7RPXIpKOwhPt4EQyD g26h1LO/r9MQItC0xdA5ZBi1MPhLu8QPkJAo6sp75pAU0ujuhuYVFm2p1ocEJwQsOdnU I9j/5DOyKa15NcUJCC1KQCW+hRTM6Xvb18YWh3YwwEjGG17dtfGlvS1k5q5T+SynlRWf Qm8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=WOfUBmdbsodFIdF1n3FF4SIyEmSqFy1s8LSqImxsRWM=; b=tOgaPKunXWGAoUPnnUCT0j79MKe88E5fYGL2PNe/vyiavg06oZjLnU4YWRGDpCjRBC uizsFdQeBBNKsS2PXNiUCNNLV3zTEEF9CBCG8X0khNsdwd8RJa41VYgpckt2PbTN94GO xJo9H67fIrhuhAXgJbpybAd6Uu7icsIh3atXzCnwpW/0KyBeW2RuHvWYz+qIZFOgDm5n CW6pU5XLZqOX/W/IBZjkd+yUeINizRIv2gTqjdqDkTuGRXZ3lpm5hVyFJHODvsXM+84H 1GMuw0vKyciwVM0rzIsWmMNCeJ/LSxkI2OPeW/Xcslu9kUSKrx8LM9QAF3m//+36BdA+ vW9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nlJtZSZE; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ec1-20020a170906b6c100b0074172ed562dsi3908234ejb.813.2022.09.10.20.23.16; Sat, 10 Sep 2022 20:23:41 -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=@gmail.com header.s=20210112 header.b=nlJtZSZE; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229740AbiIKCvA (ORCPT + 99 others); Sat, 10 Sep 2022 22:51:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229589AbiIKCu7 (ORCPT ); Sat, 10 Sep 2022 22:50:59 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 556F331DC1; Sat, 10 Sep 2022 19:50:58 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id f24so5419230plr.1; Sat, 10 Sep 2022 19:50:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=WOfUBmdbsodFIdF1n3FF4SIyEmSqFy1s8LSqImxsRWM=; b=nlJtZSZEhPJWcaLLK1L8Z+VRzHUljkNLpYXD8KRtpuPPQ6iRxm2HACBdcyt7Aq6Fkb spK6H68e/roRUpgBsjulj2U5gDlC9QluMRDO4q6bx7kM2fVuIIpKGzaAfEiWpn1E+Fkw XJxzkucYJW3BIxuhnxgcwxswjdInlc8/i2qgVkwK2CDyuQgu2GKFnI7LVm0jVdyXikzV h4gp8GuM8Q8sj2GWGpL1YNX5zgZAL1B5HbkfCLF5Y+4ZnVrCRbTV3zm3Geg9Q5f1l10b 2ornV0vei5t7/vbo2yqi9BK3EfdB2EoGSflNhNFXEcm0M2SzFaZOSXX+lOhClV4hal6/ Kvcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=WOfUBmdbsodFIdF1n3FF4SIyEmSqFy1s8LSqImxsRWM=; b=lqL5Nn87K4+ZhmWxVzH58zJ5tWeTgHk1b6L0m4w8gS8Yj4Ncm1IITfSMeVQjsGGond gVsYSwxkT0vXDI43hxmlUnH64RgctUlsK0SwZi/cSjWK+BDNMXlVGC+I1/OwpAvXZEjz nudkvmp34lJmWWfbjfeR3lOy1r0jK1rGrL0f+TdTGEdG8nN8kwfIWSzBBwkk98gFHMRD lmwOon844YHRL8HAlVaBjFwUBlSeEH8XNdgihVHdSYZ6WnCd5knTmpSsGXP37vKZw6xm wNHHs1URuUkDsRqp5qC6yeNZoKKhMnkZdZHan81l9U9U9XbpZyeqblSYxyIaxHfAVUW3 0kSg== X-Gm-Message-State: ACgBeo1QuU8vuP0ZP7R+tpMyUoLAmKNRq46YIkMfCSpZPalb3FeAhKw+ ePVhOSHYJ0ZKyr/F4cezYoU= X-Received: by 2002:a17:90a:9295:b0:202:582b:1765 with SMTP id n21-20020a17090a929500b00202582b1765mr16777561pjo.99.1662864657781; Sat, 10 Sep 2022 19:50:57 -0700 (PDT) Received: from localhost ([192.55.55.56]) by smtp.gmail.com with ESMTPSA id x5-20020a628605000000b00540d75197f2sm2493486pfd.143.2022.09.10.19.50.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Sep 2022 19:50:57 -0700 (PDT) Date: Sat, 10 Sep 2022 19:50:56 -0700 From: Isaku Yamahata To: Chao Gao Cc: isaku.yamahata@intel.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Marc Zyngier , Will Deacon , Yuan Yao , isaku.yamahata@gmail.com, Kai Huang , Atish Patra , Shaokun Zhang , Qi Liu , John Garry , Daniel Lezcano , Huang Ying , Huacai Chen Subject: Re: [PATCH v4 13/26] KVM: Add arch hook when VM is added/deleted Message-ID: <20220911025056.GA873583@ls.amr.corp.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Fri, Sep 09, 2022 at 02:08:04PM +0800, Chao Gao wrote: > >+static void kvm_del_vm(void) > >+{ > >+ cpus_read_lock(); > >+ mutex_lock(&kvm_lock); > >+ kvm_arch_del_vm(kvm_usage_count); > >+ mutex_unlock(&kvm_lock); > >+ cpus_read_unlock(); > > kvm_arch_del_vm() is an empty function now. I don't understand why > cpus_read_lock() is needed. Maybe add the lock when you fill up > kvm_arch_del_vm(). The next patch populates it with on_each_cpu(hardware_disable_nolock, NULL, 1); I will move adding lock to the next one. Or revise how adding arch hooks and populating part. -- Isaku Yamahata