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 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6518CC4338F for ; Fri, 30 Jul 2021 20:48:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4CC9860F4A for ; Fri, 30 Jul 2021 20:48:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231508AbhG3UsN (ORCPT ); Fri, 30 Jul 2021 16:48:13 -0400 Received: from mta-09-3.privateemail.com ([68.65.122.19]:16921 "EHLO MTA-09-3.privateemail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230455AbhG3UsM (ORCPT ); Fri, 30 Jul 2021 16:48:12 -0400 Received: from mta-09.privateemail.com (localhost [127.0.0.1]) by mta-09.privateemail.com (Postfix) with ESMTP id AF1DB180094A; Fri, 30 Jul 2021 16:48:06 -0400 (EDT) Received: from [192.168.0.46] (unknown [10.20.151.224]) by mta-09.privateemail.com (Postfix) with ESMTPA id 14DCF18000B7; Fri, 30 Jul 2021 16:48:03 -0400 (EDT) Date: Fri, 30 Jul 2021 16:47:57 -0400 From: Hamza Mahfooz Subject: Re: [PATCH] KVM: const-ify all relevant uses of struct kvm_memory_slot To: Peter Xu Cc: linux-kernel@vger.kernel.org, Paolo Bonzini , Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , kvm@vger.kernel.org Message-Id: In-Reply-To: References: <20210713023338.57108-1-someguy@effective-light.com> X-Mailer: geary/40.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey Peter, On Fri, Jul 30 2021 at 04:19:21 PM -0400, Peter Xu wrote: > This patch breaks kvm/queue with above issue. Constify of > kvm_memory_slot > pointer should have nothing to do with this so at least it should > need a > separate patch. At the meantime I also don't understand why memcpy() > here, > which seems to be even slower.. To const-ify the slot member of struct slot_rmap_walk_iterator, we need to initialize a new struct and then copy it over (otherwise we would need to relay on casting again or the compiler will complain about it).