From: Michal Luczaj <mhal@rbox.co>
To: Sean Christopherson <seanjc@google.com>
Cc: dmatlack@google.com, mizhang@google.com,
isaku.yamahata@gmail.com, pbonzini@redhat.com,
Wei Wang <wei.w.wang@intel.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] KVM: allow KVM_BUG/KVM_BUG_ON to handle 64-bit cond
Date: Mon, 5 Jun 2023 22:42:59 +0200 [thread overview]
Message-ID: <80f7f3dc-285f-39c3-655e-fd4a499f81a1@rbox.co> (raw)
In-Reply-To: <ZH39H0gpNX4ak6yM@google.com>
On 6/5/23 17:19, Sean Christopherson wrote:
> On Mon, Jun 05, 2023, Michal Luczaj wrote:
>> OK, so xa_store() aside[*], I see some bool-to-bools:
>>
>> arch/x86/kvm/x86.c:
>> kvm_msr_allowed():allowed = !!test_bit(index - start, bitmap);
>> arch/x86/kvm/hyperv.c:
>> kvm_hv_hypercall():hc.rep = !!(hc.rep_cnt || hc.rep_idx);
>> arch/x86/kvm/mmu/mmu.c:
>> update_pkru_bitmask():
>> pkey_bits = !!check_pkey;
>> pkey_bits |= (!!check_write) << 1;
>> arch/x86/kvm/svm/svm.c:
>> msr_write_intercepted():return !!test_bit(bit_write, &tmp);
>> svm_vcpu_after_set_cpuid():
>> 2x set_msr_interception...
>> tools/testing/selftests/kvm/x86_64/vmx_exception_with_invalid_guest_state.c:
>> set_or_clear_invalid_guest_state():sregs.tr.unusable = !!set;
>>
>> But perhaps this is a matter of style and those were meant to be this kind-of
>> explicit?
>
> I doubt it, I'm guessing most cases are due to the author being overzealous for
> one reason or another, e.g. I suspect the test_bit() ones are due to the original
> author incorrectly assuming test_bit() returned an unsigned long, i.e. the bit,
> as opposed to the bool.
>
> If you want to clean these up, I'd say "fix" the test_bit() cases, but leave the
> others alone. The test_bit() ones are clearly redundant, and IMO can be actively
> due to implying test_bit() returns something other than a bool.
Done: https://lore.kernel.org/kvm/20230605200158.118109-1-mhal@rbox.co/
prev parent reply other threads:[~2023-06-05 20:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 13:52 Wei Wang
2023-03-07 16:35 ` Mingwei Zhang
2023-03-08 23:26 ` Sean Christopherson
2023-06-01 13:30 ` Wang, Wei W
2023-06-01 16:20 ` Sean Christopherson
2023-06-02 0:52 ` Wang, Wei W
2023-06-02 1:20 ` Sean Christopherson
2023-06-02 16:47 ` Michal Luczaj
2023-06-02 16:56 ` Sean Christopherson
2023-06-05 11:53 ` Michal Luczaj
2023-06-05 15:19 ` Sean Christopherson
2023-06-05 20:42 ` Michal Luczaj [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=80f7f3dc-285f-39c3-655e-fd4a499f81a1@rbox.co \
--to=mhal@rbox.co \
--cc=dmatlack@google.com \
--cc=isaku.yamahata@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mizhang@google.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=wei.w.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®