* [PATCH 0/6] KVM: fix checkpatch warnings
@ 2022-03-05 20:55 Henry Sloan
2022-03-05 20:55 ` [PATCH 1/6] KVM: Use typical SPDX comment style Henry Sloan
` (5 more replies)
0 siblings, 6 replies; 13+ messages in thread
From: Henry Sloan @ 2022-03-05 20:55 UTC (permalink / raw)
Cc: pbonzini, Henry Sloan, kvm, linux-kernel
This patchset fixes many checkpatch warnings in the virt/kvm directory.
The warnings and errors that will remain are of the following kinds:
* "memory barrier without comment" warnings that don't have trivial fixes
* "function definition argument should also have an identifier name"
warnings
* Numerous minor issues in kvm_main.c that merit a separate patch
Henry Sloan (6):
KVM: Use typical SPDX comment style
KVM: Replace bare 'unsigned' with 'unsigned int'
KVM: Replace '__attribute__((weak))' with '__weak'
KVM: Add blank lines after some declarations
KVM: Use typical style for block comments
KVM: Fix minor indentation and brace style issues
virt/kvm/coalesced_mmio.c | 2 +-
virt/kvm/dirty_ring.c | 2 +-
virt/kvm/eventfd.c | 21 +++++++------
virt/kvm/irqchip.c | 16 ++++++----
virt/kvm/kvm_main.c | 64 +++++++++++++++++++++------------------
virt/kvm/kvm_mm.h | 2 +-
virt/kvm/pfncache.c | 2 +-
7 files changed, 60 insertions(+), 49 deletions(-)
--
2.35.1
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/6] KVM: Use typical SPDX comment style
2022-03-05 20:55 [PATCH 0/6] KVM: fix checkpatch warnings Henry Sloan
@ 2022-03-05 20:55 ` Henry Sloan
2022-03-05 20:55 ` [PATCH 2/6] KVM: Replace bare 'unsigned' with 'unsigned int' Henry Sloan
` (4 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Henry Sloan @ 2022-03-05 20:55 UTC (permalink / raw)
Cc: pbonzini, Henry Sloan, kvm, linux-kernel
Signed-off-by: Henry Sloan <henryksloan@gmail.com>
---
virt/kvm/dirty_ring.c | 2 +-
virt/kvm/kvm_mm.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/virt/kvm/dirty_ring.c b/virt/kvm/dirty_ring.c
index 222ecc81d7df..f4c2a6eb1666 100644
--- a/virt/kvm/dirty_ring.c
+++ b/virt/kvm/dirty_ring.c
@@ -1,4 +1,4 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
+// SPDX-License-Identifier: GPL-2.0-only
/*
* KVM dirty ring implementation
*
diff --git a/virt/kvm/kvm_mm.h b/virt/kvm/kvm_mm.h
index 34ca40823260..41da467d99c9 100644
--- a/virt/kvm/kvm_mm.h
+++ b/virt/kvm/kvm_mm.h
@@ -1,4 +1,4 @@
-// SPDX-License-Identifier: GPL-2.0-only
+/* SPDX-License-Identifier: GPL-2.0-only */
#ifndef __KVM_MM_H__
#define __KVM_MM_H__ 1
--
2.35.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/6] KVM: Replace bare 'unsigned' with 'unsigned int'
2022-03-05 20:55 [PATCH 0/6] KVM: fix checkpatch warnings Henry Sloan
2022-03-05 20:55 ` [PATCH 1/6] KVM: Use typical SPDX comment style Henry Sloan
@ 2022-03-05 20:55 ` Henry Sloan
2022-03-06 0:49 ` Joe Perches
2022-03-05 20:55 ` [PATCH 3/6] KVM: Replace '__attribute__((weak))' with '__weak' Henry Sloan
` (3 subsequent siblings)
5 siblings, 1 reply; 13+ messages in thread
From: Henry Sloan @ 2022-03-05 20:55 UTC (permalink / raw)
Cc: pbonzini, Henry Sloan, kvm, linux-kernel
Signed-off-by: Henry Sloan <henryksloan@gmail.com>
---
virt/kvm/coalesced_mmio.c | 2 +-
virt/kvm/eventfd.c | 8 ++++----
virt/kvm/irqchip.c | 6 +++---
virt/kvm/kvm_main.c | 16 ++++++++--------
4 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index 0be80c213f7f..1ff2bca6489c 100644
--- a/virt/kvm/coalesced_mmio.c
+++ b/virt/kvm/coalesced_mmio.c
@@ -43,7 +43,7 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev, u32 last)
{
struct kvm_coalesced_mmio_ring *ring;
- unsigned avail;
+ unsigned int avail;
/* Are we able to batch it ? */
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 59b1dd4a549e..1054ddb915b0 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -182,14 +182,14 @@ int __attribute__((weak)) kvm_arch_set_irq_inatomic(
* Called with wqh->lock held and interrupts disabled
*/
static int
-irqfd_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, void *key)
+irqfd_wakeup(wait_queue_entry_t *wait, unsigned int mode, int sync, void *key)
{
struct kvm_kernel_irqfd *irqfd =
container_of(wait, struct kvm_kernel_irqfd, wait);
__poll_t flags = key_to_poll(key);
struct kvm_kernel_irq_routing_entry irq;
struct kvm *kvm = irqfd->kvm;
- unsigned seq;
+ unsigned int seq;
int idx;
int ret = 0;
@@ -455,7 +455,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
return ret;
}
-bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin)
+bool kvm_irq_has_notifier(struct kvm *kvm, unsigned int irqchip, unsigned int pin)
{
struct kvm_irq_ack_notifier *kian;
int gsi, idx;
@@ -486,7 +486,7 @@ void kvm_notify_acked_gsi(struct kvm *kvm, int gsi)
kian->irq_acked(kian);
}
-void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
+void kvm_notify_acked_irq(struct kvm *kvm, unsigned int irqchip, unsigned int pin)
{
int gsi, idx;
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index 58e4f88b2b9f..dcd51e6efb8a 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -38,7 +38,7 @@ int kvm_irq_map_gsi(struct kvm *kvm,
return n;
}
-int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin)
+int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned int irqchip, unsigned int pin)
{
struct kvm_irq_routing_table *irq_rt;
@@ -168,8 +168,8 @@ bool __weak kvm_arch_can_set_irq_routing(struct kvm *kvm)
int kvm_set_irq_routing(struct kvm *kvm,
const struct kvm_irq_routing_entry *ue,
- unsigned nr,
- unsigned flags)
+ unsigned int nr,
+ unsigned int flags)
{
struct kvm_irq_routing_table *new, *old;
struct kvm_kernel_irq_routing_entry *e;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 0afc016cc54d..c5fb79e64e75 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -216,7 +216,7 @@ void vcpu_put(struct kvm_vcpu *vcpu)
EXPORT_SYMBOL_GPL(vcpu_put);
/* TODO: merge with kvm_arch_vcpu_should_kick */
-static bool kvm_request_needs_ipi(struct kvm_vcpu *vcpu, unsigned req)
+static bool kvm_request_needs_ipi(struct kvm_vcpu *vcpu, unsigned int req)
{
int mode = kvm_vcpu_exiting_guest_mode(vcpu);
@@ -415,7 +415,7 @@ void *kvm_mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc)
}
#endif
-static void kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
+static void kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned int id)
{
mutex_init(&vcpu->mutex);
vcpu->cpu = -1;
@@ -3454,7 +3454,7 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
*/
if (kvm_arch_vcpu_should_kick(vcpu)) {
cpu = READ_ONCE(vcpu->cpu);
- if (cpu != me && (unsigned)cpu < nr_cpu_ids && cpu_online(cpu))
+ if (cpu != me && (unsigned int)cpu < nr_cpu_ids && cpu_online(cpu))
smp_send_reschedule(cpu);
}
out:
@@ -5366,7 +5366,7 @@ static const struct file_operations stat_fops_per_vm = {
static int vm_stat_get(void *_offset, u64 *val)
{
- unsigned offset = (long)_offset;
+ unsigned int offset = (long)_offset;
struct kvm *kvm;
u64 tmp_val;
@@ -5382,7 +5382,7 @@ static int vm_stat_get(void *_offset, u64 *val)
static int vm_stat_clear(void *_offset, u64 val)
{
- unsigned offset = (long)_offset;
+ unsigned int offset = (long)_offset;
struct kvm *kvm;
if (val)
@@ -5402,7 +5402,7 @@ DEFINE_SIMPLE_ATTRIBUTE(vm_stat_readonly_fops, vm_stat_get, NULL, "%llu\n");
static int vcpu_stat_get(void *_offset, u64 *val)
{
- unsigned offset = (long)_offset;
+ unsigned int offset = (long)_offset;
struct kvm *kvm;
u64 tmp_val;
@@ -5418,7 +5418,7 @@ static int vcpu_stat_get(void *_offset, u64 *val)
static int vcpu_stat_clear(void *_offset, u64 val)
{
- unsigned offset = (long)_offset;
+ unsigned int offset = (long)_offset;
struct kvm *kvm;
if (val)
@@ -5654,7 +5654,7 @@ static void check_processor_compat(void *data)
*c->ret = kvm_arch_check_processor_compat(c->opaque);
}
-int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
+int kvm_init(void *opaque, unsigned int vcpu_size, unsigned int vcpu_align,
struct module *module)
{
struct kvm_cpu_compat_check c;
--
2.35.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/6] KVM: Replace '__attribute__((weak))' with '__weak'
2022-03-05 20:55 [PATCH 0/6] KVM: fix checkpatch warnings Henry Sloan
2022-03-05 20:55 ` [PATCH 1/6] KVM: Use typical SPDX comment style Henry Sloan
2022-03-05 20:55 ` [PATCH 2/6] KVM: Replace bare 'unsigned' with 'unsigned int' Henry Sloan
@ 2022-03-05 20:55 ` Henry Sloan
2022-03-05 20:55 ` [PATCH 4/6] KVM: Add blank lines after some declarations Henry Sloan
` (2 subsequent siblings)
5 siblings, 0 replies; 13+ messages in thread
From: Henry Sloan @ 2022-03-05 20:55 UTC (permalink / raw)
Cc: pbonzini, Henry Sloan, kvm, linux-kernel
Signed-off-by: Henry Sloan <henryksloan@gmail.com>
---
virt/kvm/eventfd.c | 12 ++++++------
virt/kvm/irqchip.c | 2 +-
virt/kvm/kvm_main.c | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 1054ddb915b0..14aef85829ed 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -32,7 +32,7 @@
static struct workqueue_struct *irqfd_cleanup_wq;
-bool __attribute__((weak))
+bool __weak
kvm_arch_irqfd_allowed(struct kvm *kvm, struct kvm_irqfd *args)
{
return true;
@@ -169,7 +169,7 @@ irqfd_deactivate(struct kvm_kernel_irqfd *irqfd)
queue_work(irqfd_cleanup_wq, &irqfd->shutdown);
}
-int __attribute__((weak)) kvm_arch_set_irq_inatomic(
+int __weak kvm_arch_set_irq_inatomic(
struct kvm_kernel_irq_routing_entry *irq,
struct kvm *kvm, int irq_source_id,
int level,
@@ -265,24 +265,24 @@ static void irqfd_update(struct kvm *kvm, struct kvm_kernel_irqfd *irqfd)
}
#ifdef CONFIG_HAVE_KVM_IRQ_BYPASS
-void __attribute__((weak)) kvm_arch_irq_bypass_stop(
+void __weak kvm_arch_irq_bypass_stop(
struct irq_bypass_consumer *cons)
{
}
-void __attribute__((weak)) kvm_arch_irq_bypass_start(
+void __weak kvm_arch_irq_bypass_start(
struct irq_bypass_consumer *cons)
{
}
-int __attribute__((weak)) kvm_arch_update_irqfd_routing(
+int __weak kvm_arch_update_irqfd_routing(
struct kvm *kvm, unsigned int host_irq,
uint32_t guest_irq, bool set)
{
return 0;
}
-bool __attribute__((weak)) kvm_arch_irqfd_route_changed(
+bool __weak kvm_arch_irqfd_route_changed(
struct kvm_kernel_irq_routing_entry *old,
struct kvm_kernel_irq_routing_entry *new)
{
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index dcd51e6efb8a..baa551aec010 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -157,7 +157,7 @@ static int setup_routing_entry(struct kvm *kvm,
return 0;
}
-void __attribute__((weak)) kvm_arch_irq_routing_update(struct kvm *kvm)
+void __weak kvm_arch_irq_routing_update(struct kvm *kvm)
{
}
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index c5fb79e64e75..af74cf3b6446 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -4386,7 +4386,7 @@ static int kvm_vm_ioctl_reset_dirty_pages(struct kvm *kvm)
return cleared;
}
-int __attribute__((weak)) kvm_vm_ioctl_enable_cap(struct kvm *kvm,
+int __weak kvm_vm_ioctl_enable_cap(struct kvm *kvm,
struct kvm_enable_cap *cap)
{
return -EINVAL;
--
2.35.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/6] KVM: Add blank lines after some declarations
2022-03-05 20:55 [PATCH 0/6] KVM: fix checkpatch warnings Henry Sloan
` (2 preceding siblings ...)
2022-03-05 20:55 ` [PATCH 3/6] KVM: Replace '__attribute__((weak))' with '__weak' Henry Sloan
@ 2022-03-05 20:55 ` Henry Sloan
2022-03-05 20:55 ` [PATCH 5/6] KVM: Use typical style for block comments Henry Sloan
2022-03-05 20:55 ` [PATCH 6/6] KVM: Fix minor indentation and brace style issues Henry Sloan
5 siblings, 0 replies; 13+ messages in thread
From: Henry Sloan @ 2022-03-05 20:55 UTC (permalink / raw)
Cc: pbonzini, Henry Sloan, kvm, linux-kernel
Signed-off-by: Henry Sloan <henryksloan@gmail.com>
---
virt/kvm/eventfd.c | 1 +
virt/kvm/irqchip.c | 2 ++
virt/kvm/kvm_main.c | 4 ++++
3 files changed, 7 insertions(+)
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 14aef85829ed..2e47bd13413e 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -195,6 +195,7 @@ irqfd_wakeup(wait_queue_entry_t *wait, unsigned int mode, int sync, void *key)
if (flags & EPOLLIN) {
u64 cnt;
+
eventfd_ctx_do_read(irqfd->eventfd, &cnt);
idx = srcu_read_lock(&kvm->irq_srcu);
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index baa551aec010..69a327c043d7 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -86,6 +86,7 @@ int kvm_set_irq(struct kvm *kvm, int irq_source_id, u32 irq, int level,
while (i--) {
int r;
+
r = irq_set[i].set(&irq_set[i], kvm, irq_source_id, level,
line_status);
if (r < 0)
@@ -122,6 +123,7 @@ void kvm_free_irq_routing(struct kvm *kvm)
/* Called only during vm destruction. Nobody can use the pointer
at this stage */
struct kvm_irq_routing_table *rt = rcu_access_pointer(kvm->irq_routing);
+
free_irq_routing_table(rt);
}
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index af74cf3b6446..1988dd081606 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2171,6 +2171,7 @@ static int kvm_clear_dirty_log_protect(struct kvm *kvm,
i++, offset += BITS_PER_LONG) {
unsigned long mask = *dirty_bitmap_buffer++;
atomic_long_t *p = (atomic_long_t *) &dirty_bitmap[i];
+
if (!mask)
continue;
@@ -2477,6 +2478,7 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
* not call the fault handler, so do it here.
*/
bool unlocked = false;
+
r = fixup_user_fault(current->mm, addr,
(write_fault ? FAULT_FLAG_WRITE : 0),
&unlocked);
@@ -3053,6 +3055,7 @@ int kvm_gfn_to_hva_cache_init(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
gpa_t gpa, unsigned long len)
{
struct kvm_memslots *slots = kvm_memslots(kvm);
+
return __kvm_gfn_to_hva_cache_init(slots, ghc, gpa, len);
}
EXPORT_SYMBOL_GPL(kvm_gfn_to_hva_cache_init);
@@ -3887,6 +3890,7 @@ static long kvm_vcpu_ioctl(struct file *filp,
switch (ioctl) {
case KVM_RUN: {
struct pid *oldpid;
+
r = -EINVAL;
if (arg)
goto out;
--
2.35.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 5/6] KVM: Use typical style for block comments
2022-03-05 20:55 [PATCH 0/6] KVM: fix checkpatch warnings Henry Sloan
` (3 preceding siblings ...)
2022-03-05 20:55 ` [PATCH 4/6] KVM: Add blank lines after some declarations Henry Sloan
@ 2022-03-05 20:55 ` Henry Sloan
2022-03-05 20:55 ` [PATCH 6/6] KVM: Fix minor indentation and brace style issues Henry Sloan
5 siblings, 0 replies; 13+ messages in thread
From: Henry Sloan @ 2022-03-05 20:55 UTC (permalink / raw)
Cc: pbonzini, Henry Sloan, kvm, linux-kernel
Signed-off-by: Henry Sloan <henryksloan@gmail.com>
---
virt/kvm/irqchip.c | 6 ++++--
virt/kvm/kvm_main.c | 6 +++---
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index 69a327c043d7..80708f6ec9d9 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -120,8 +120,10 @@ static void free_irq_routing_table(struct kvm_irq_routing_table *rt)
void kvm_free_irq_routing(struct kvm *kvm)
{
- /* Called only during vm destruction. Nobody can use the pointer
- at this stage */
+ /*
+ * Called only during vm destruction. Nobody can use the pointer
+ * at this stage
+ */
struct kvm_irq_routing_table *rt = rcu_access_pointer(kvm->irq_routing);
free_irq_routing_table(rt);
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 1988dd081606..1a9f20e3fa2d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2182,7 +2182,7 @@ static int kvm_clear_dirty_log_protect(struct kvm *kvm,
* never includes any bits beyond the length of the memslot (if
* the length is not aligned to 64 pages), therefore it is not
* a problem if userspace sets them in log->dirty_bitmap.
- */
+ */
if (mask) {
flush = true;
kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot,
@@ -5245,8 +5245,8 @@ static int kvm_debugfs_open(struct inode *inode, struct file *file,
/*
* The debugfs files are a reference to the kvm struct which
- * is still valid when kvm_destroy_vm is called. kvm_get_kvm_safe
- * avoids the race between open and the removal of the debugfs directory.
+ * is still valid when kvm_destroy_vm is called. kvm_get_kvm_safe
+ * avoids the race between open and the removal of the debugfs directory.
*/
if (!kvm_get_kvm_safe(stat_data->kvm))
return -ENOENT;
--
2.35.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 6/6] KVM: Fix minor indentation and brace style issues
2022-03-05 20:55 [PATCH 0/6] KVM: fix checkpatch warnings Henry Sloan
` (4 preceding siblings ...)
2022-03-05 20:55 ` [PATCH 5/6] KVM: Use typical style for block comments Henry Sloan
@ 2022-03-05 20:55 ` Henry Sloan
2022-03-05 21:07 ` Joe Perches
` (2 more replies)
5 siblings, 3 replies; 13+ messages in thread
From: Henry Sloan @ 2022-03-05 20:55 UTC (permalink / raw)
Cc: pbonzini, Henry Sloan, kvm, linux-kernel
Signed-off-by: Henry Sloan <henryksloan@gmail.com>
---
virt/kvm/kvm_main.c | 36 +++++++++++++++++++-----------------
virt/kvm/pfncache.c | 2 +-
2 files changed, 20 insertions(+), 18 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 1a9f20e3fa2d..c899da4515c0 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -132,7 +132,10 @@ static long kvm_vcpu_compat_ioctl(struct file *file, unsigned int ioctl,
* passed to a compat task, let the ioctls fail.
*/
static long kvm_no_compat_ioctl(struct file *file, unsigned int ioctl,
- unsigned long arg) { return -EINVAL; }
+ unsigned long arg)
+{
+ return -EINVAL;
+}
static int kvm_no_compat_open(struct inode *inode, struct file *file)
{
@@ -2154,9 +2157,9 @@ static int kvm_clear_dirty_log_protect(struct kvm *kvm,
n = ALIGN(log->num_pages, BITS_PER_LONG) / 8;
if (log->first_page > memslot->npages ||
- log->num_pages > memslot->npages - log->first_page ||
- (log->num_pages < memslot->npages - log->first_page && (log->num_pages & 63)))
- return -EINVAL;
+ log->num_pages > memslot->npages - log->first_page ||
+ (log->num_pages < memslot->npages - log->first_page && (log->num_pages & 63)))
+ return -EINVAL;
kvm_arch_sync_dirty_log(kvm, memslot);
@@ -2517,7 +2520,7 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
* tail pages of non-compound higher order allocations, which
* would then underflow the refcount when the caller does the
* required put_page. Don't allow those pages here.
- */
+ */
if (!kvm_try_get_pfn(pfn))
r = -EFAULT;
@@ -2906,7 +2909,7 @@ int kvm_vcpu_read_guest(struct kvm_vcpu *vcpu, gpa_t gpa, void *data, unsigned l
EXPORT_SYMBOL_GPL(kvm_vcpu_read_guest);
static int __kvm_read_guest_atomic(struct kvm_memory_slot *slot, gfn_t gfn,
- void *data, int offset, unsigned long len)
+ void *data, int offset, unsigned long len)
{
int r;
unsigned long addr;
@@ -2923,7 +2926,7 @@ static int __kvm_read_guest_atomic(struct kvm_memory_slot *slot, gfn_t gfn,
}
int kvm_vcpu_read_guest_atomic(struct kvm_vcpu *vcpu, gpa_t gpa,
- void *data, unsigned long len)
+ void *data, unsigned long len)
{
gfn_t gfn = gpa >> PAGE_SHIFT;
struct kvm_memory_slot *slot = kvm_vcpu_gfn_to_memslot(vcpu, gfn);
@@ -2934,8 +2937,8 @@ int kvm_vcpu_read_guest_atomic(struct kvm_vcpu *vcpu, gpa_t gpa,
EXPORT_SYMBOL_GPL(kvm_vcpu_read_guest_atomic);
static int __kvm_write_guest_page(struct kvm *kvm,
- struct kvm_memory_slot *memslot, gfn_t gfn,
- const void *data, int offset, int len)
+ struct kvm_memory_slot *memslot, gfn_t gfn,
+ const void *data, int offset, int len)
{
int r;
unsigned long addr;
@@ -2990,7 +2993,7 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
EXPORT_SYMBOL_GPL(kvm_write_guest);
int kvm_vcpu_write_guest(struct kvm_vcpu *vcpu, gpa_t gpa, const void *data,
- unsigned long len)
+ unsigned long len)
{
gfn_t gfn = gpa >> PAGE_SHIFT;
int seg;
@@ -3011,8 +3014,8 @@ int kvm_vcpu_write_guest(struct kvm_vcpu *vcpu, gpa_t gpa, const void *data,
EXPORT_SYMBOL_GPL(kvm_vcpu_write_guest);
static int __kvm_gfn_to_hva_cache_init(struct kvm_memslots *slots,
- struct gfn_to_hva_cache *ghc,
- gpa_t gpa, unsigned long len)
+ struct gfn_to_hva_cache *ghc,
+ gpa_t gpa, unsigned long len)
{
int offset = offset_in_page(gpa);
gfn_t start_gfn = gpa >> PAGE_SHIFT;
@@ -3156,8 +3159,8 @@ int kvm_clear_guest(struct kvm *kvm, gpa_t gpa, unsigned long len)
EXPORT_SYMBOL_GPL(kvm_clear_guest);
void mark_page_dirty_in_slot(struct kvm *kvm,
- const struct kvm_memory_slot *memslot,
- gfn_t gfn)
+ const struct kvm_memory_slot *memslot,
+ gfn_t gfn)
{
struct kvm_vcpu *vcpu = kvm_get_running_vcpu();
@@ -5176,9 +5179,8 @@ int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
return 0;
for (i = 0; i < bus->dev_count; i++) {
- if (bus->range[i].dev == dev) {
+ if (bus->range[i].dev == dev)
break;
- }
}
if (i == bus->dev_count)
@@ -5599,7 +5601,7 @@ EXPORT_SYMBOL_GPL(kvm_get_running_vcpu);
*/
struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void)
{
- return &kvm_running_vcpu;
+ return &kvm_running_vcpu;
}
#ifdef CONFIG_GUEST_PERF_EVENTS
diff --git a/virt/kvm/pfncache.c b/virt/kvm/pfncache.c
index ce878f4be4da..072c9a9e44b1 100644
--- a/virt/kvm/pfncache.c
+++ b/virt/kvm/pfncache.c
@@ -237,7 +237,7 @@ int kvm_gfn_to_pfn_cache_refresh(struct kvm *kvm, struct gfn_to_pfn_cache *gpc,
ret = -EFAULT;
}
- map_done:
+ map_done:
write_lock_irq(&gpc->lock);
if (ret) {
gpc->valid = false;
--
2.35.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 6/6] KVM: Fix minor indentation and brace style issues
2022-03-05 20:55 ` [PATCH 6/6] KVM: Fix minor indentation and brace style issues Henry Sloan
@ 2022-03-05 21:07 ` Joe Perches
2022-03-05 21:53 ` [PATCH v2 " Henry Sloan
2022-03-06 1:28 ` [PATCH v2 2/6] KVM: Replace bare 'unsigned' with 'unsigned int' Henry Sloan
2 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2022-03-05 21:07 UTC (permalink / raw)
To: Henry Sloan; +Cc: pbonzini, kvm, linux-kernel
On Sat, 2022-03-05 at 15:55 -0500, Henry Sloan wrote:
> Signed-off-by: Henry Sloan <henryksloan@gmail.com>
> ---
> virt/kvm/kvm_main.c | 36 +++++++++++++++++++-----------------
> virt/kvm/pfncache.c | 2 +-
> 2 files changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
[]
> @@ -2154,9 +2157,9 @@ static int kvm_clear_dirty_log_protect(struct kvm *kvm,
> n = ALIGN(log->num_pages, BITS_PER_LONG) / 8;
>
> if (log->first_page > memslot->npages ||
> - log->num_pages > memslot->npages - log->first_page ||
> - (log->num_pages < memslot->npages - log->first_page && (log->num_pages & 63)))
> - return -EINVAL;
> + log->num_pages > memslot->npages - log->first_page ||
> + (log->num_pages < memslot->npages - log->first_page && (log->num_pages & 63)))
> + return -EINVAL;
The change to indentation on the return statement is good
but the change to the indentation on the if statement block is not.
Perhaps a better change might be:
if (log->first_page > memslot->npages ||
log->num_pages > memslot->npages - log->first_page ||
(log->num_pages < memslot->npages - log->first_page &&
(log->num_pages & 63)))
return -EINVAL;
>
> kvm_arch_sync_dirty_log(kvm, memslot);
>
> @@ -2517,7 +2520,7 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
> * tail pages of non-compound higher order allocations, which
> * would then underflow the refcount when the caller does the
> * required put_page. Don't allow those pages here.
> - */
> + */
> if (!kvm_try_get_pfn(pfn))
> r = -EFAULT;
>
> @@ -2906,7 +2909,7 @@ int kvm_vcpu_read_guest(struct kvm_vcpu *vcpu, gpa_t gpa, void *data, unsigned l
> EXPORT_SYMBOL_GPL(kvm_vcpu_read_guest);
>
> static int __kvm_read_guest_atomic(struct kvm_memory_slot *slot, gfn_t gfn,
> - void *data, int offset, unsigned long len)
> + void *data, int offset, unsigned long len)
> {
> int r;
> unsigned long addr;
> @@ -2923,7 +2926,7 @@ static int __kvm_read_guest_atomic(struct kvm_memory_slot *slot, gfn_t gfn,
> }
>
> int kvm_vcpu_read_guest_atomic(struct kvm_vcpu *vcpu, gpa_t gpa,
> - void *data, unsigned long len)
> + void *data, unsigned long len)
These whitespace changes are somewhat odd and unnecessary.
It's generally preferred to align to arguments to the open parenthesis.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2 6/6] KVM: Fix minor indentation and brace style issues
2022-03-05 20:55 ` [PATCH 6/6] KVM: Fix minor indentation and brace style issues Henry Sloan
2022-03-05 21:07 ` Joe Perches
@ 2022-03-05 21:53 ` Henry Sloan
2022-03-06 1:28 ` [PATCH v2 2/6] KVM: Replace bare 'unsigned' with 'unsigned int' Henry Sloan
2 siblings, 0 replies; 13+ messages in thread
From: Henry Sloan @ 2022-03-05 21:53 UTC (permalink / raw)
Cc: pbonzini, Henry Sloan, kvm, linux-kernel
Signed-off-by: Henry Sloan <henryksloan@gmail.com>
---
virt/kvm/kvm_main.c | 25 ++++++++++++++-----------
virt/kvm/pfncache.c | 2 +-
2 files changed, 15 insertions(+), 12 deletions(-)
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 1a9f20e3fa2d..eea5b18b8efe 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -132,7 +132,10 @@ static long kvm_vcpu_compat_ioctl(struct file *file, unsigned int ioctl,
* passed to a compat task, let the ioctls fail.
*/
static long kvm_no_compat_ioctl(struct file *file, unsigned int ioctl,
- unsigned long arg) { return -EINVAL; }
+ unsigned long arg)
+{
+ return -EINVAL;
+}
static int kvm_no_compat_open(struct inode *inode, struct file *file)
{
@@ -2155,8 +2158,9 @@ static int kvm_clear_dirty_log_protect(struct kvm *kvm,
if (log->first_page > memslot->npages ||
log->num_pages > memslot->npages - log->first_page ||
- (log->num_pages < memslot->npages - log->first_page && (log->num_pages & 63)))
- return -EINVAL;
+ (log->num_pages < memslot->npages - log->first_page &&
+ (log->num_pages & 63)))
+ return -EINVAL;
kvm_arch_sync_dirty_log(kvm, memslot);
@@ -2517,7 +2521,7 @@ static int hva_to_pfn_remapped(struct vm_area_struct *vma,
* tail pages of non-compound higher order allocations, which
* would then underflow the refcount when the caller does the
* required put_page. Don't allow those pages here.
- */
+ */
if (!kvm_try_get_pfn(pfn))
r = -EFAULT;
@@ -2906,7 +2910,7 @@ int kvm_vcpu_read_guest(struct kvm_vcpu *vcpu, gpa_t gpa, void *data, unsigned l
EXPORT_SYMBOL_GPL(kvm_vcpu_read_guest);
static int __kvm_read_guest_atomic(struct kvm_memory_slot *slot, gfn_t gfn,
- void *data, int offset, unsigned long len)
+ void *data, int offset, unsigned long len)
{
int r;
unsigned long addr;
@@ -2935,7 +2939,7 @@ EXPORT_SYMBOL_GPL(kvm_vcpu_read_guest_atomic);
static int __kvm_write_guest_page(struct kvm *kvm,
struct kvm_memory_slot *memslot, gfn_t gfn,
- const void *data, int offset, int len)
+ const void *data, int offset, int len)
{
int r;
unsigned long addr;
@@ -2990,7 +2994,7 @@ int kvm_write_guest(struct kvm *kvm, gpa_t gpa, const void *data,
EXPORT_SYMBOL_GPL(kvm_write_guest);
int kvm_vcpu_write_guest(struct kvm_vcpu *vcpu, gpa_t gpa, const void *data,
- unsigned long len)
+ unsigned long len)
{
gfn_t gfn = gpa >> PAGE_SHIFT;
int seg;
@@ -3157,7 +3161,7 @@ EXPORT_SYMBOL_GPL(kvm_clear_guest);
void mark_page_dirty_in_slot(struct kvm *kvm,
const struct kvm_memory_slot *memslot,
- gfn_t gfn)
+ gfn_t gfn)
{
struct kvm_vcpu *vcpu = kvm_get_running_vcpu();
@@ -5176,9 +5180,8 @@ int kvm_io_bus_unregister_dev(struct kvm *kvm, enum kvm_bus bus_idx,
return 0;
for (i = 0; i < bus->dev_count; i++) {
- if (bus->range[i].dev == dev) {
+ if (bus->range[i].dev == dev)
break;
- }
}
if (i == bus->dev_count)
@@ -5599,7 +5602,7 @@ EXPORT_SYMBOL_GPL(kvm_get_running_vcpu);
*/
struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void)
{
- return &kvm_running_vcpu;
+ return &kvm_running_vcpu;
}
#ifdef CONFIG_GUEST_PERF_EVENTS
diff --git a/virt/kvm/pfncache.c b/virt/kvm/pfncache.c
index ce878f4be4da..072c9a9e44b1 100644
--- a/virt/kvm/pfncache.c
+++ b/virt/kvm/pfncache.c
@@ -237,7 +237,7 @@ int kvm_gfn_to_pfn_cache_refresh(struct kvm *kvm, struct gfn_to_pfn_cache *gpc,
ret = -EFAULT;
}
- map_done:
+ map_done:
write_lock_irq(&gpc->lock);
if (ret) {
gpc->valid = false;
--
2.35.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/6] KVM: Replace bare 'unsigned' with 'unsigned int'
2022-03-05 20:55 ` [PATCH 2/6] KVM: Replace bare 'unsigned' with 'unsigned int' Henry Sloan
@ 2022-03-06 0:49 ` Joe Perches
0 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2022-03-06 0:49 UTC (permalink / raw)
To: Henry Sloan; +Cc: pbonzini, kvm, linux-kernel
On Sat, 2022-03-05 at 15:55 -0500, Henry Sloan wrote:
> Signed-off-by: Henry Sloan <henryksloan@gmail.com>
> ---
> virt/kvm/coalesced_mmio.c | 2 +-
[]
> diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
[]
> @@ -43,7 +43,7 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
> static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev, u32 last)
> {
> struct kvm_coalesced_mmio_ring *ring;
> - unsigned avail;
> + unsigned int avail;
>
> /* Are we able to batch it ? */
>
Instead of just converting this to unsigned int,
the function return could be converted to bool.
So could another int return in the same file.
Something like:
---
virt/kvm/coalesced_mmio.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index 0be80c213f7f2..452ae20c9ed06 100644
--- a/virt/kvm/coalesced_mmio.c
+++ b/virt/kvm/coalesced_mmio.c
@@ -22,28 +22,28 @@ static inline struct kvm_coalesced_mmio_dev *to_mmio(struct kvm_io_device *dev)
return container_of(dev, struct kvm_coalesced_mmio_dev, dev);
}
-static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
- gpa_t addr, int len)
+static bool coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
+ gpa_t addr, int len)
{
/* is it in a batchable area ?
* (addr,len) is fully included in
* (zone->addr, zone->size)
*/
if (len < 0)
- return 0;
+ return false;
if (addr + len < addr)
- return 0;
+ return false;
if (addr < dev->zone.addr)
- return 0;
+ return false;
if (addr + len > dev->zone.addr + dev->zone.size)
- return 0;
- return 1;
+ return false;
+
+ return true;
}
-static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev, u32 last)
+static bool coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev, u32 last)
{
struct kvm_coalesced_mmio_ring *ring;
- unsigned avail;
/* Are we able to batch it ? */
@@ -52,13 +52,8 @@ static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev, u32 last)
* there is always one unused entry in the buffer
*/
ring = dev->kvm->coalesced_mmio_ring;
- avail = (ring->first - last - 1) % KVM_COALESCED_MMIO_MAX;
- if (avail == 0) {
- /* full */
- return 0;
- }
- return 1;
+ return (ring->first - last - 1) % KVM_COALESCED_MMIO_MAX != 0;
}
static int coalesced_mmio_write(struct kvm_vcpu *vcpu,
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH v2 2/6] KVM: Replace bare 'unsigned' with 'unsigned int'
2022-03-05 20:55 ` [PATCH 6/6] KVM: Fix minor indentation and brace style issues Henry Sloan
2022-03-05 21:07 ` Joe Perches
2022-03-05 21:53 ` [PATCH v2 " Henry Sloan
@ 2022-03-06 1:28 ` Henry Sloan
2022-03-06 1:37 ` Joe Perches
2 siblings, 1 reply; 13+ messages in thread
From: Henry Sloan @ 2022-03-06 1:28 UTC (permalink / raw)
Cc: pbonzini, Henry Sloan, kvm, linux-kernel
Signed-off-by: Henry Sloan <henryksloan@gmail.com>
---
virt/kvm/coalesced_mmio.c | 23 ++++++++---------------
virt/kvm/eventfd.c | 8 ++++----
virt/kvm/irqchip.c | 6 +++---
virt/kvm/kvm_main.c | 16 ++++++++--------
4 files changed, 23 insertions(+), 30 deletions(-)
diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index 0be80c213f7f..b0501a2538d7 100644
--- a/virt/kvm/coalesced_mmio.c
+++ b/virt/kvm/coalesced_mmio.c
@@ -22,7 +22,7 @@ static inline struct kvm_coalesced_mmio_dev *to_mmio(struct kvm_io_device *dev)
return container_of(dev, struct kvm_coalesced_mmio_dev, dev);
}
-static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
+static bool coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
gpa_t addr, int len)
{
/* is it in a batchable area ?
@@ -30,20 +30,19 @@ static int coalesced_mmio_in_range(struct kvm_coalesced_mmio_dev *dev,
* (zone->addr, zone->size)
*/
if (len < 0)
- return 0;
+ return false;
if (addr + len < addr)
- return 0;
+ return false;
if (addr < dev->zone.addr)
- return 0;
+ return false;
if (addr + len > dev->zone.addr + dev->zone.size)
- return 0;
- return 1;
+ return false;
+ return true;
}
-static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev, u32 last)
+static bool coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev, u32 last)
{
struct kvm_coalesced_mmio_ring *ring;
- unsigned avail;
/* Are we able to batch it ? */
@@ -52,13 +51,7 @@ static int coalesced_mmio_has_room(struct kvm_coalesced_mmio_dev *dev, u32 last)
* there is always one unused entry in the buffer
*/
ring = dev->kvm->coalesced_mmio_ring;
- avail = (ring->first - last - 1) % KVM_COALESCED_MMIO_MAX;
- if (avail == 0) {
- /* full */
- return 0;
- }
-
- return 1;
+ return (ring->first - last - 1) % KVM_COALESCED_MMIO_MAX != 0;
}
static int coalesced_mmio_write(struct kvm_vcpu *vcpu,
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 59b1dd4a549e..1054ddb915b0 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -182,14 +182,14 @@ int __attribute__((weak)) kvm_arch_set_irq_inatomic(
* Called with wqh->lock held and interrupts disabled
*/
static int
-irqfd_wakeup(wait_queue_entry_t *wait, unsigned mode, int sync, void *key)
+irqfd_wakeup(wait_queue_entry_t *wait, unsigned int mode, int sync, void *key)
{
struct kvm_kernel_irqfd *irqfd =
container_of(wait, struct kvm_kernel_irqfd, wait);
__poll_t flags = key_to_poll(key);
struct kvm_kernel_irq_routing_entry irq;
struct kvm *kvm = irqfd->kvm;
- unsigned seq;
+ unsigned int seq;
int idx;
int ret = 0;
@@ -455,7 +455,7 @@ kvm_irqfd_assign(struct kvm *kvm, struct kvm_irqfd *args)
return ret;
}
-bool kvm_irq_has_notifier(struct kvm *kvm, unsigned irqchip, unsigned pin)
+bool kvm_irq_has_notifier(struct kvm *kvm, unsigned int irqchip, unsigned int pin)
{
struct kvm_irq_ack_notifier *kian;
int gsi, idx;
@@ -486,7 +486,7 @@ void kvm_notify_acked_gsi(struct kvm *kvm, int gsi)
kian->irq_acked(kian);
}
-void kvm_notify_acked_irq(struct kvm *kvm, unsigned irqchip, unsigned pin)
+void kvm_notify_acked_irq(struct kvm *kvm, unsigned int irqchip, unsigned int pin)
{
int gsi, idx;
diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index 58e4f88b2b9f..dcd51e6efb8a 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -38,7 +38,7 @@ int kvm_irq_map_gsi(struct kvm *kvm,
return n;
}
-int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin)
+int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned int irqchip, unsigned int pin)
{
struct kvm_irq_routing_table *irq_rt;
@@ -168,8 +168,8 @@ bool __weak kvm_arch_can_set_irq_routing(struct kvm *kvm)
int kvm_set_irq_routing(struct kvm *kvm,
const struct kvm_irq_routing_entry *ue,
- unsigned nr,
- unsigned flags)
+ unsigned int nr,
+ unsigned int flags)
{
struct kvm_irq_routing_table *new, *old;
struct kvm_kernel_irq_routing_entry *e;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 0afc016cc54d..c5fb79e64e75 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -216,7 +216,7 @@ void vcpu_put(struct kvm_vcpu *vcpu)
EXPORT_SYMBOL_GPL(vcpu_put);
/* TODO: merge with kvm_arch_vcpu_should_kick */
-static bool kvm_request_needs_ipi(struct kvm_vcpu *vcpu, unsigned req)
+static bool kvm_request_needs_ipi(struct kvm_vcpu *vcpu, unsigned int req)
{
int mode = kvm_vcpu_exiting_guest_mode(vcpu);
@@ -415,7 +415,7 @@ void *kvm_mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc)
}
#endif
-static void kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id)
+static void kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned int id)
{
mutex_init(&vcpu->mutex);
vcpu->cpu = -1;
@@ -3454,7 +3454,7 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
*/
if (kvm_arch_vcpu_should_kick(vcpu)) {
cpu = READ_ONCE(vcpu->cpu);
- if (cpu != me && (unsigned)cpu < nr_cpu_ids && cpu_online(cpu))
+ if (cpu != me && (unsigned int)cpu < nr_cpu_ids && cpu_online(cpu))
smp_send_reschedule(cpu);
}
out:
@@ -5366,7 +5366,7 @@ static const struct file_operations stat_fops_per_vm = {
static int vm_stat_get(void *_offset, u64 *val)
{
- unsigned offset = (long)_offset;
+ unsigned int offset = (long)_offset;
struct kvm *kvm;
u64 tmp_val;
@@ -5382,7 +5382,7 @@ static int vm_stat_get(void *_offset, u64 *val)
static int vm_stat_clear(void *_offset, u64 val)
{
- unsigned offset = (long)_offset;
+ unsigned int offset = (long)_offset;
struct kvm *kvm;
if (val)
@@ -5402,7 +5402,7 @@ DEFINE_SIMPLE_ATTRIBUTE(vm_stat_readonly_fops, vm_stat_get, NULL, "%llu\n");
static int vcpu_stat_get(void *_offset, u64 *val)
{
- unsigned offset = (long)_offset;
+ unsigned int offset = (long)_offset;
struct kvm *kvm;
u64 tmp_val;
@@ -5418,7 +5418,7 @@ static int vcpu_stat_get(void *_offset, u64 *val)
static int vcpu_stat_clear(void *_offset, u64 val)
{
- unsigned offset = (long)_offset;
+ unsigned int offset = (long)_offset;
struct kvm *kvm;
if (val)
@@ -5654,7 +5654,7 @@ static void check_processor_compat(void *data)
*c->ret = kvm_arch_check_processor_compat(c->opaque);
}
-int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,
+int kvm_init(void *opaque, unsigned int vcpu_size, unsigned int vcpu_align,
struct module *module)
{
struct kvm_cpu_compat_check c;
--
2.35.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/6] KVM: Replace bare 'unsigned' with 'unsigned int'
2022-03-06 1:28 ` [PATCH v2 2/6] KVM: Replace bare 'unsigned' with 'unsigned int' Henry Sloan
@ 2022-03-06 1:37 ` Joe Perches
[not found] ` <CAFJXJGHc3D3U+BOBW2BqSX-vhsXSCZ-=R2ydfMtVML02+C3MuQ@mail.gmail.com>
0 siblings, 1 reply; 13+ messages in thread
From: Joe Perches @ 2022-03-06 1:37 UTC (permalink / raw)
To: Henry Sloan; +Cc: pbonzini, kvm, linux-kernel
On Sat, 2022-03-05 at 20:28 -0500, Henry Sloan wrote:
> Signed-off-by: Henry Sloan <henryksloan@gmail.com>
Now the subject/patch description doesn't agree with the patch
so a different subject line needs to be used.
Perhaps the bool conversion should be a separate patch.
Also, this should have a change log below the --- like
> ---
v2: Use bool instead of unsigned int in coalesced_mmio.c
so people can know what has been changed between the original
submission and this V2 patch.
> virt/kvm/coalesced_mmio.c | 23 ++++++++---------------
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2 2/6] KVM: Replace bare 'unsigned' with 'unsigned int'
[not found] ` <CAFJXJGHc3D3U+BOBW2BqSX-vhsXSCZ-=R2ydfMtVML02+C3MuQ@mail.gmail.com>
@ 2022-03-06 1:53 ` Joe Perches
0 siblings, 0 replies; 13+ messages in thread
From: Joe Perches @ 2022-03-06 1:53 UTC (permalink / raw)
To: Henry Sloan; +Cc: pbonzini, kvm, linux-kernel
On Sat, 2022-03-05 at 20:44 -0500, Henry Sloan wrote:
> I agree the bool conversion should be a separate patch. Would it be proper
> to resubmit the whole patchset with a new, seventh patch containing the
> bool conversion? If I was to do so, should all of those patches be labelled
> v2, but without any changelogs since none of the present patches will have
> been changed?
Generally yes, but it depends on the upstream maintainer's preference.
Ideally:
o a 0/n patch cover letter could be used to describe the change/addition
o each proposed patch has a patch description above your Signed-off-by:
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-03-06 1:53 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-05 20:55 [PATCH 0/6] KVM: fix checkpatch warnings Henry Sloan
2022-03-05 20:55 ` [PATCH 1/6] KVM: Use typical SPDX comment style Henry Sloan
2022-03-05 20:55 ` [PATCH 2/6] KVM: Replace bare 'unsigned' with 'unsigned int' Henry Sloan
2022-03-06 0:49 ` Joe Perches
2022-03-05 20:55 ` [PATCH 3/6] KVM: Replace '__attribute__((weak))' with '__weak' Henry Sloan
2022-03-05 20:55 ` [PATCH 4/6] KVM: Add blank lines after some declarations Henry Sloan
2022-03-05 20:55 ` [PATCH 5/6] KVM: Use typical style for block comments Henry Sloan
2022-03-05 20:55 ` [PATCH 6/6] KVM: Fix minor indentation and brace style issues Henry Sloan
2022-03-05 21:07 ` Joe Perches
2022-03-05 21:53 ` [PATCH v2 " Henry Sloan
2022-03-06 1:28 ` [PATCH v2 2/6] KVM: Replace bare 'unsigned' with 'unsigned int' Henry Sloan
2022-03-06 1:37 ` Joe Perches
[not found] ` <CAFJXJGHc3D3U+BOBW2BqSX-vhsXSCZ-=R2ydfMtVML02+C3MuQ@mail.gmail.com>
2022-03-06 1:53 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).