On Wed, Jun 07, 2023, Jinrong Liang wrote:
-static struct kvm_pmu_event_filter *remove_event(struct kvm_pmu_event_filter *f, +static struct kvm_pmu_event_filter *remove_event(struct __kvm_pmu_event_filter *__f, uint64_t event)
Can you tack on a patch to drop the return? None of the callers consume it, and it incorrectly implies that the incoming filter isn't modified.
{ bool found = false; int i;
- struct kvm_pmu_event_filter *f = (void *)__f;
Nit, reverse xmas tree is preferred:
struct kvm_pmu_event_filter *f = (void *)__f; bool found = false; int i;
Hoever, I don't think this one needs to cast, the cast is only necessary when invoking a KVM ioctl(), e.g. I believe this should work:
static void remove_event(struct __kvm_pmu_event_filter *f, uint64_t event) { bool found = false; int i;
for (i = 0; i < f->nevents; i++) { if (found) f->events[i - 1] = f->events[i]; else found = f->events[i] == event; } if (found) f->nevents--; }
@@ -569,19 +554,16 @@ static void run_masked_events_test(struct kvm_vcpu *vcpu, const uint64_t masked_events[], const int nmasked_events) {
- struct kvm_pmu_event_filter *f;
- struct __kvm_pmu_event_filter f = {
.nevents = nmasked_events,
.action = KVM_PMU_EVENT_ALLOW,
.flags = KVM_PMU_EVENT_FLAG_MASKED_EVENTS,
Tabs, not spaces please.
+static int set_pmu_single_event_filter(struct kvm_vcpu *vcpu, uint64_t event,
uint32_t flags, uint32_t action)
+{
- struct __kvm_pmu_event_filter f = {
.nevents = 1,
.flags = flags,
.action = action,
.events = {
event,
Tabs.