Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp905608rwb; Wed, 28 Sep 2022 10:29:45 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7eMe45zlQ1JjnvHYM5N+apSGrGow+2vNf1YCxRnxZ/CPL6hhcYuhwd0Cgu8etuoxKU+sE6 X-Received: by 2002:a63:88c1:0:b0:440:3cd1:5cca with SMTP id l184-20020a6388c1000000b004403cd15ccamr1458046pgd.393.1664386184905; Wed, 28 Sep 2022 10:29:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664386184; cv=none; d=google.com; s=arc-20160816; b=P79ubf3l/w9z3hXeSyLURcEtf81y8HwuJfAPycruUP6VWdscW5o4TGL9SS7nK1257i fMWXa9X7f0eZfhE3B+NABvyCj2JuTdezyfUAASn6R8aXl1mMLE+oPe8OXqjgxsYnLC16 WQAIraGPo5MR4OgCttCROfUSLtS7Rkobm2ChD8bvsaupuCi4hYefmCeKIg6zjIfpz0B5 Ks+rhX4HH8bcLHylYUPcecnZn+b+GdBQzeOU+Qm7T+d2wBB2yPqcRgoeuF0x9K7Xo8Aw oKSmrPn0N/yNwSV/oaoG23cjo8EMkiPj3T1y/HJ9h2kQbdnRKEQqxcYR3X6Se2i7dBwB NXZQ== 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=X/r6KCKf1vxWod/Dk6IGZU/aQVyTqynzb69MIGT/niI=; b=dlloHAYWLPAWjnZac/0Ta7uFJW9puNSiLOJiJ8XUr85dc9Da1dL/HEUKxcD24LzrMQ 32g8TVe6TbLPrHT6CR9oxvJx0bCpZl8Kk7D+sGAwvOYi1pvfsl9I60amEo9/FXmuYVgT jOFiqtitDWYodt1Hwnny+HJGX4bvyb72/drZPOwYGYdPj3Dkn2e488ypyd5Ia2mQUVeW BjPCmtfApfbtULLGhZHTOvnrulvR9pnzSKcvUD0bu9/9D54jW8YEriNcSMZgxTHtfOkI n0QdK32/A/izB64IeTiAuVTUeBTMi2V7qyHRgDIDYSFSJnbHdaaRBLhtinyFgaCLp9f/ /pGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Soq+qQv9; 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 q2-20020a056a00150200b005415de7fd01si3712633pfu.203.2022.09.28.10.29.33; Wed, 28 Sep 2022 10:29:44 -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=Soq+qQv9; 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 S234479AbiI1RSn (ORCPT + 99 others); Wed, 28 Sep 2022 13:18:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234473AbiI1RSd (ORCPT ); Wed, 28 Sep 2022 13:18:33 -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 ESMTPS id DECBCCEB for ; Wed, 28 Sep 2022 10:18:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664385512; 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=X/r6KCKf1vxWod/Dk6IGZU/aQVyTqynzb69MIGT/niI=; b=Soq+qQv94hjXcPonQYr/bOXTlKjC9/1Fus/1+iKmBMfpUJ2UIkyNoKy1DBq4tFRVqWZ5RU Lgib3mFKEzG2zRDDmH6u2WdC+TnntPXWgNTesIiLMfEgxvlqW9TMm5MRSk2PMN7w5knLgV hedj1JSX8B5kqvwQw4uB0RG3n0ExuiQ= 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.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-624-0dMFG0vnNjGmS5rELwguNA-1; Wed, 28 Sep 2022 13:18:31 -0400 X-MC-Unique: 0dMFG0vnNjGmS5rELwguNA-1 Received: by mail-ej1-f70.google.com with SMTP id xh12-20020a170906da8c00b007413144e87fso5807376ejb.14 for ; Wed, 28 Sep 2022 10:18:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=X/r6KCKf1vxWod/Dk6IGZU/aQVyTqynzb69MIGT/niI=; b=M0qDlH+QV5LvfnAYvFP3S8N4ugCcAZBDpc0ZHFz6//67Jd/pkXhQVGylIMTb5VQRyE tTJSPvlDxnuA97gUJUspJqRUnaI39V8LiXGoGEjDD1QvdBMPiL4kdxHzZBXx/Cb9rwZx +aYrxIPgbvlJ9AWzr2cuMqdU8M9xqgkln/ZU8NwYbImsu5/5+70MAOmoyCQtu/CyQHwD U6+eAKClbYRFSf2CbCstjeAmNhhnPesakLNUj/k2E6hrroE8fyzin7sbk9kGe20Ch0Kv bx10QvOyV5hduPPNA45c6Kr5eKn8nOVQ7e6Y4bHnROy2dMijRscDSDyuCR3oAyzOVOmR 7TSA== X-Gm-Message-State: ACrzQf2cZ3Wprfu9AuXZ6ZzoH2+9E2GqLG185gzVj3TQw6+s+z4XZSWT iYnwVL2B5n9P4vuyDcF4wlfEumJsSQnufy7des16BCoELDb9f8NxpYqrxfTpZ3nGve5v2vvgJZS LC6XAsp7iuyFIufM1QZfDXMfc X-Received: by 2002:a17:907:a067:b0:77b:9672:3f83 with SMTP id ia7-20020a170907a06700b0077b96723f83mr27719524ejc.523.1664385509625; Wed, 28 Sep 2022 10:18:29 -0700 (PDT) X-Received: by 2002:a17:907:a067:b0:77b:9672:3f83 with SMTP id ia7-20020a170907a06700b0077b96723f83mr27719507ejc.523.1664385509419; Wed, 28 Sep 2022 10:18:29 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:2f4b:62da:3159:e077? ([2001:b07:6468:f312:2f4b:62da:3159:e077]) by smtp.googlemail.com with ESMTPSA id m5-20020a1709062ac500b00773dbdd8205sm2644031eje.168.2022.09.28.10.18.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Sep 2022 10:18:28 -0700 (PDT) Message-ID: <3e457190-8ebc-2234-5a14-79cab89b393f@redhat.com> Date: Wed, 28 Sep 2022 19:18:27 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Subject: Re: [RFC PATCH 7/9] kvm_main.c: duplicate invalid memslot also in inactive list Content-Language: en-US To: Emanuele Giuseppe Esposito , kvm@vger.kernel.org Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , David Hildenbrand , Maxim Levitsky , x86@kernel.org, "H. Peter Anvin" , linux-kernel@vger.kernel.org References: <20220909104506.738478-1-eesposit@redhat.com> <20220909104506.738478-8-eesposit@redhat.com> From: Paolo Bonzini In-Reply-To: <20220909104506.738478-8-eesposit@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 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_NONE,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 9/9/22 12:45, Emanuele Giuseppe Esposito wrote: > /* > - * if change is DELETE or MOVE, invalid is in active memslots > - * and old in inactive, so replace old with new. > + * if change is DELETE or MOVE, invalid is in both active and inactive > + * memslot list. This means that we don't need old anymore, and > + * we should replace invalid with new. > */ > - kvm_replace_memslot(kvm, batch->old, batch->new); > + if (batch->change == KVM_MR_DELETE || batch->change == KVM_MR_MOVE) > + kvm_replace_memslot(kvm, batch->invalid, batch->new); > + else > + kvm_replace_memslot(kvm, batch->old, batch->new); This is also kvm_replace_memslot(kvm, batch->invalid ?: batch->old, batch->new); with no need to look at batch->change. Paolo