On Tue, Sep 20, 2022, David Matlack wrote: > On Thu, Sep 1, 2022 at 9:47 AM David Matlack <dmatlack@xxxxxxxxxx> wrote: > > On Tue, Aug 30, 2022 at 3:12 AM Huang, Kai <kai.huang@xxxxxxxxx> wrote: > > > On Fri, 2022-08-26 at 16:12 -0700, David Matlack wrote: > [...] > > > > +#else > > > > +/* TDP MMU is not supported on 32-bit KVM. */ > > > > +const bool tdp_mmu_enabled; > > > > +#endif > > > > + > > > > > > I am not sure by using 'const bool' the compile will always omit the function > > > call? I did some experiment on my 64-bit system and it seems if we don't use > > > any -O option then the generated code still does function call. > > > > > > How about just (if it works): > > > > > > #define tdp_mmu_enabled false > > > > I can give it a try. By the way, I wonder if the existing code > > compiles without -O. The existing code relies on a static inline > > function returning false on 32-bit KVM, which doesn't seem like it > > would be any easier for the compiler to optimize out than a const > > bool. But who knows. > > Actually, how did you compile without -O and is that a supported use-case? Eh, IMO whether or not an unoptimized build is supported is moot. KVM already uses "#define <param> 0/false", e.g. see enable_sgx, I don't see any reason to employ a different method.