Received: by 2002:a05:7412:6592:b0:d7:7d3a:4fe2 with SMTP id m18csp655126rdg; Thu, 10 Aug 2023 15:13:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFdWdBfhJZuVEipMQlmvPnkQ283jlzraJvBMFnDF+xCJobqEgs3OE6rMp9oAPZzfJpokiJD X-Received: by 2002:a17:90b:382:b0:268:a4e1:fc3d with SMTP id ga2-20020a17090b038200b00268a4e1fc3dmr3155377pjb.40.1691705607428; Thu, 10 Aug 2023 15:13:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691705607; cv=none; d=google.com; s=arc-20160816; b=mdUiHQric7HTra3aTssLh4GKMKzEj1CA5EDg2uaF4Fc+qeF3ECh3XxsL+G3hKBYCCL ZhiAEDgSw1hMdlMZdBcDDDUGGF7WpAMUrouWxHzAG8mJTzYrlU6O8objYv/HqsUeOzIn +MqGs2ZhA6oHJCP1mGD9+1q+YwfUUU/IEFPGDhoN2aI0qK5nK89gvQKxFiMtgo2I89kg NYS8V01vAL+TxuyJOAadD4ZdryYBW9DQrL8dWWIqHaDOp5zlBcDd78rsZdRk5yx1V+6w e/xNXbBlV/EywougcMpb0C+ybZ1tNLzNwWh3DX8sR+q4YhKOQqcWkkhphYJH/19ZpQzN wwmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Fbz6nfirzOItWcULJrhy76vEH5UntBJ+zAdtRqxrtIs=; fh=3piszIRZElahW0+ObyZgnjDbrQp4q+FGwGpEMYVT4QI=; b=WQHZkJJwwRxN45+G9e5s85NXEiop4F1iRsPz7x1T/YLh/FAxy8tTTyTwXJr5bo5/z0 QLZc3i9BlMUHavEUqyySZpBzZaIA3YSgYNiPQlEwFkjL0TM567X5GM/BgHAmXijmkOJQ 7nHHWCSBjHXAFpGE5dcFlcjViym+60it+Z/KR53M5qopVGbt4nd+12yMMqWNjUX8celp FCJyYC4SlMdZGsWvPpWw+bjZyHYwO0AHRaiXmF5I3rz+W2ljToAT3ih0OU3p3ZPzAb/N Wy7QH8Ssrik14r6uuBDga2rIxK0kpMJvhQMv8ZFAOqDL7pMi+wa7L7ODRe9hD2Ph16Qg 0zBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=mkXquOWI; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d1-20020a17090ac24100b00262e650abadsi2236627pjx.117.2023.08.10.15.13.14; Thu, 10 Aug 2023 15:13:27 -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=@google.com header.s=20221208 header.b=mkXquOWI; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229518AbjHJUzL (ORCPT + 99 others); Thu, 10 Aug 2023 16:55:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjHJUzK (ORCPT ); Thu, 10 Aug 2023 16:55:10 -0400 Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0B972733 for ; Thu, 10 Aug 2023 13:55:07 -0700 (PDT) Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-40c72caec5cso23501cf.0 for ; Thu, 10 Aug 2023 13:55:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1691700907; x=1692305707; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Fbz6nfirzOItWcULJrhy76vEH5UntBJ+zAdtRqxrtIs=; b=mkXquOWImM+ipsQFpSuV6HphXWcMu0DYJyCRbKA/Dq79yQhHG6TR+uE6DNBjdtFfKW 9Ou/urveYZ4pdU9VR2letW3AyzwHrPpup+XFQvg0vonxJ42AGrE0ltKx1/f55708OXYf vRUx09Hzn0lW4KrJOE9nmWrwtUjt3v4ixV/ExTTUVlINSh80tyHy1p6Y/nwisurUxSg3 Wmv9YQlCHLhD3Pnz+PxZu242lj8GKSajSa1rIlgV/+M9oPmy8Wnkw4+ChJ0Lg9d6ijtw nCaMDID/yxucfw6q1AGYHCMLPpDCnZU/dtO0FRBlOqagop7dekdu3rV5nFgzRGnaj5/N zDEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691700907; x=1692305707; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Fbz6nfirzOItWcULJrhy76vEH5UntBJ+zAdtRqxrtIs=; b=WyxlQZOXraKLJm5wg0vu4uPvzLFyEweNT1FfEIRQipUMj+amG7Gxh1EDucBycofVIf 8CuBpcT62eeWmPq+L2ReCtybpk3yFziKJa1WFiJ06WMUibudC+oX7cL0r4FH0x0xXXXO vtNR939+ZRIJqGl7S3cwd03AhmZG01ArIOe+rx73hj7tlrgA1wyV1MCMhvL8XIrU0AE+ 7PrGljgudLn/LDl2Ls5wK+fGvt25sv51YwSoFvD8n2fFFPvQ+9+oZo65/fej6nWeX3Tt naVWLR8MfRjDZMqBSozDI/fctoPVs0L3BEr0zihgSL4VJ7Owx15+ZencbyhYLU/uWmjz rwnQ== X-Gm-Message-State: AOJu0YyLrDhy3xsPr7vJ4Taz+YL1YCiYWkAAi4z8Y86VG/+9zlnMMNtO rUeYXps3A7/mNANpwqla7AIgjlGsL16BDfdZ9bo8Qg== X-Received: by 2002:ac8:7f86:0:b0:403:96e3:4745 with SMTP id z6-20020ac87f86000000b0040396e34745mr69781qtj.20.1691700906744; Thu, 10 Aug 2023 13:55:06 -0700 (PDT) MIME-Version: 1.0 References: <20230808231330.3855936-1-rananta@google.com> <20230808231330.3855936-3-rananta@google.com> <30e45ef3-309a-63de-e085-be1645c1be79@redhat.com> In-Reply-To: <30e45ef3-309a-63de-e085-be1645c1be79@redhat.com> From: Raghavendra Rao Ananta Date: Thu, 10 Aug 2023 13:54:55 -0700 Message-ID: Subject: Re: [PATCH v8 02/14] KVM: Declare kvm_arch_flush_remote_tlbs() globally To: Shaoqin Huang Cc: Gavin Shan , Oliver Upton , Marc Zyngier , James Morse , Suzuki K Poulose , Paolo Bonzini , Sean Christopherson , Huacai Chen , Zenghui Yu , Anup Patel , Atish Patra , Jing Zhang , Reiji Watanabe , Colton Lewis , David Matlack , Fuad Tabba , linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Thu, Aug 10, 2023 at 5:26=E2=80=AFAM Shaoqin Huang = wrote: > > > > On 8/10/23 00:38, Raghavendra Rao Ananta wrote: > > Hi Gavin, > > > > On Tue, Aug 8, 2023 at 9:00=E2=80=AFPM Gavin Shan wr= ote: > >> > >> > >> On 8/9/23 09:13, Raghavendra Rao Ananta wrote: > >>> There's no reason for the architectures to declare > >>> kvm_arch_flush_remote_tlbs() in their own headers. Hence to > >>> avoid this duplication, make the declaration global, leaving > >>> the architectures to define only __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS > >>> as needed. > >>> > >>> Signed-off-by: Raghavendra Rao Ananta > >>> --- > >>> arch/mips/include/asm/kvm_host.h | 1 - > >>> include/linux/kvm_host.h | 2 ++ > >>> 2 files changed, 2 insertions(+), 1 deletion(-) > >>> > >>> diff --git a/arch/mips/include/asm/kvm_host.h b/arch/mips/include/asm= /kvm_host.h > >>> index 9b0ad8f3bf327..54a85f1d4f2c8 100644 > >>> --- a/arch/mips/include/asm/kvm_host.h > >>> +++ b/arch/mips/include/asm/kvm_host.h > >>> @@ -897,6 +897,5 @@ static inline void kvm_arch_vcpu_blocking(struct = kvm_vcpu *vcpu) {} > >>> static inline void kvm_arch_vcpu_unblocking(struct kvm_vcpu *vcpu)= {} > >>> > >>> #define __KVM_HAVE_ARCH_FLUSH_REMOTE_TLBS > >>> -int kvm_arch_flush_remote_tlbs(struct kvm *kvm); > >>> > >>> #endif /* __MIPS_KVM_HOST_H__ */ > >>> diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h > >>> index e3f968b38ae97..ade5d4500c2ce 100644 > >>> --- a/include/linux/kvm_host.h > >>> +++ b/include/linux/kvm_host.h > >>> @@ -1484,6 +1484,8 @@ static inline int kvm_arch_flush_remote_tlbs(st= ruct kvm *kvm) > >>> { > >>> return -ENOTSUPP; > >>> } > >>> +#else > >>> +int kvm_arch_flush_remote_tlbs(struct kvm *kvm); > >>> #endif > >>> > >>> #ifdef __KVM_HAVE_ARCH_NONCOHERENT_DMA > >> > >> Is the declaration inconsistent to that in arch/x86/include/asm/kvm_ho= st.h? > >> In order to keep them consistent, I guess we need move kvm_arch_flush_= remote_tlbs() > >> from x86's header file to arch/x86/kvm/mmu/mmu.c and 'inline' needs to= be dropped. > >> > > Unsure of the original intentions, I didn't want to disturb any > > existing arrangements. If more people agree to this refactoring, I'm > > happy to move. > > This is amazing to me. This change can be compiled without any error > even if the declaration inconsistent between the kvm_host.h and x86's > header file. > > I'm curious which option make it possible? > After doing some experiments, I think it works because of the order in which the inline-definition and the declaration are laid out. If the 'inline' part of the function comes first and then the declaration, we don't see any error. However if the positions were reversed, we would see an error. (I'm not sure what the technical reason for this is). Just to be safe, I can move the definition to arch/x86/kvm/mmu/mmu.c as a non-inline function. Thank you. Raghavendra > Thanks, > Shaoqin > > > > > Thank you. > > Raghavendra > >> Thanks, > >> Gavin > >> > > > > -- > Shaoqin >