Re: [PATCH 04/22] KVM: mmu: extract spte.h and spte.c

From: Valdis Klētnieks
Date: Tue Oct 27 2020 - 10:46:51 EST


On Fri, 23 Oct 2020 12:30:06 -0400, Paolo Bonzini said:
> The SPTE format will be common to both the shadow and the TDP MMU.
>
> Extract code that implements the format to a separate module, as a
> first step towards adding the TDP MMU and putting mmu.c on a diet.
>
> Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>

This died a horrid death on my laptop when building with W=1.

CC arch/x86/kvm/mmu/tdp_iter.o
In file included from arch/x86/kvm/mmu/tdp_iter.c:5:
arch/x86/kvm/mmu/spte.h:120:18: error: 'shadow_nonpresent_or_rsvd_mask_len' defined but not used [-Werror=unused-const-variable=]
120 | static const u64 shadow_nonpresent_or_rsvd_mask_len = 5;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/mmu/spte.h:115:18: error: 'shadow_acc_track_saved_bits_shift' defined but not used [-Werror=unused-const-variable=]
115 | static const u64 shadow_acc_track_saved_bits_shift = PT64_SECOND_AVAIL_BITS_SHIFT;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/x86/kvm/mmu/spte.h:113:18: error: 'shadow_acc_track_saved_bits_mask' defined but not used [-Werror=unused-const-variable=]
113 | static const u64 shadow_acc_track_saved_bits_mask = PT64_EPT_READABLE_MASK |
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[2]: *** [scripts/Makefile.build:283: arch/x86/kvm/mmu/tdp_iter.o] Error 1
make[1]: *** [scripts/Makefile.build:500: arch/x86/kvm] Error 2
make: *** [Makefile:1799: arch/x86] Error 2

Do we really need to define 3 static variables in every .c file that includes
this .h file, directly or not?

Attachment: pgpgYBwibFqDg.pgp
Description: PGP signature