RISC-V KVM: Add exit logic to main.c
Subsystems (2)
PATCH 1/1 RISC-V KVM: Add exit logic to main.c
Several lines of code are inserted to remove KVM module normally using rmmod command just like others.
--- arch/riscv/kvm/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/riscv/kvm/main.c +6 -0
@@ -122,6 +122,12 @@ void kvm_arch_exit(void) { } +static void riscv_kvm_exit (void ) +{ +kvm_exit (); +} +module_exit (riscv_kvm_exit); +static int riscv_kvm_init (void ) {return kvm_init (NULL ,sizeof (struct kvm_vcpu ),0 ,THIS_MODULE );
Signature · 1 line
2.25.1
PATCH 1/1 RISC-V KVM: Add exit logic to main.c
Quoted 27 lines · XiakaiPan
Several lines of code are inserted to remove KVM module normally using rmmod command just like others.
Signed-off-by XiakaiPan <[email protected]>--- arch/riscv/kvm/main.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/riscv/kvm/main.c +6
-0@@ -122,6 +122,12 @@ void kvm_arch_exit(void) { } +static void riscv_kvm_exit (void ) +{ +kvm_exit (); +} +module_exit (riscv_kvm_exit); +static int riscv_kvm_init (void ) {return kvm_init (NULL ,sizeof (struct kvm_vcpu ),0 ,THIS_MODULE );Signature · 1 line
2.25.1
LGTM, assuming we don't need the riscv kvm module to be permanent for some reason. If we do, then I guess we need a comment here by module_init() stating that. I did test loading and unloading multiple times and running VMs in between, no fireballs appeared.
Anup Patel
maintainerPATCH 1/1 RISC-V KVM: Add exit logic to main.c
In reply to XiakaiPanQuoted 13 lines · XiakaiPan
Several lines of code are inserted to remove KVM module normally using rmmod command just like others.
Signed-off-by XiakaiPan <[email protected]>--- arch/riscv/kvm/main.c | 6 ++++++ 1 file changed, 6 insertions(+)arch/riscv/kvm/main.c +0
-0
arch/riscv/kvm/main.c void kvm_arch_exit(void) · line 125
Quoted 4 lines
arch/riscv/kvm/main.c +1
-0@@ -122,6 +122,12 @@ void kvm_arch_exit(void) { } +static void riscv_kvm_exit (void )
Add __exit attribute to riscv_kvm_exit()
arch/riscv/kvm/main.c void kvm_arch_exit(void) · line 127
Quoted 2 lines
arch/riscv/kvm/main.c +2
-0+{ +kvm_exit ();
Use tab instead of space for indentation.
Quoted 9 lines
arch/riscv/kvm/main.c +3
-1+} +module_exit (riscv_kvm_exit); +static int riscv_kvm_init (void ) {return kvm_init (NULL ,sizeof (struct kvm_vcpu ),0 ,THIS_MODULE ); --2.25.1
I have taken care of the above comments at the
time of applying this patch.
Queued this patch for Linux-6.2
Thanks,
Anup