<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/arch/mips/kvm/mips.c, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/arch/mips/kvm/mips.c?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/arch/mips/kvm/mips.c?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-02-01T13:51:53Z</updated>
<entry>
<title>kvm/mips: rework guest entry logic</title>
<updated>2022-02-01T13:51:53Z</updated>
<author>
<name>Mark Rutland</name>
<email>mark.rutland@arm.com</email>
</author>
<published>2022-02-01T13:29:26Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=72e3244512b34756a7e8aa67eff45cdcb040ac4e'/>
<id>urn:sha1:72e3244512b34756a7e8aa67eff45cdcb040ac4e</id>
<content type='text'>
In kvm_arch_vcpu_ioctl_run() we use guest_enter_irqoff() and
guest_exit_irqoff() directly, with interrupts masked between these. As
we don't handle any timer ticks during this window, we will not account
time spent within the guest as guest time, which is unfortunate.

Additionally, we do not inform lockdep or tracing that interrupts will
be enabled during guest execution, which caan lead to misleading traces
and warnings that interrupts have been enabled for overly-long periods.

This patch fixes these issues by using the new timing and context
entry/exit helpers to ensure that interrupts are handled during guest
vtime but with RCU watching, with a sequence:

	guest_timing_enter_irqoff();

	guest_state_enter_irqoff();
	&lt; run the vcpu &gt;
	guest_state_exit_irqoff();

	&lt; take any pending IRQs &gt;

	guest_timing_exit_irqoff();

In addition, as guest exits during the "run the vcpu" step are handled
by kvm_mips_handle_exit(), a wrapper function is added which ensures
that such exists are handled with a sequence:

	guest_state_exit_irqoff();
	&lt; handle the exit &gt;
	guest_state_enter_irqoff();

This means that exits which stop the vCPU running will have a redundant
guest_state_enter_irqoff() .. guest_state_exit_irqoff() sequence, which
can be addressed with future rework.

Since instrumentation may make use of RCU, we must also ensure that no
instrumented code is run during the EQS. I've split out the critical
section into a new kvm_mips_enter_exit_vcpu() helper which is marked
noinstr.

Signed-off-by: Mark Rutland &lt;mark.rutland@arm.com&gt;
Cc: Aleksandar Markovic &lt;aleksandar.qemu.devel@gmail.com&gt;
Cc: Frederic Weisbecker &lt;frederic@kernel.org&gt;
Cc: Huacai Chen &lt;chenhuacai@kernel.org&gt;
Cc: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Cc: Paul E. McKenney &lt;paulmck@kernel.org&gt;
Cc: Thomas Bogendoerfer &lt;tsbogend@alpha.franken.de&gt;
Message-Id: &lt;20220201132926.3301912-6-mark.rutland@arm.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: Stop passing kvm_userspace_memory_region to arch memslot hooks</title>
<updated>2021-12-08T09:24:25Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2021-12-06T19:54:18Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=6a99c6e3f52a6f0d4c6ebcfa7359c718a19ffbe6'/>
<id>urn:sha1:6a99c6e3f52a6f0d4c6ebcfa7359c718a19ffbe6</id>
<content type='text'>
Drop the @mem param from kvm_arch_{prepare,commit}_memory_region() now
that its use has been removed in all architectures.

No functional change intended.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Reviewed-by: Maciej S. Szmigiero &lt;maciej.szmigiero@oracle.com&gt;
Signed-off-by: Maciej S. Szmigiero &lt;maciej.szmigiero@oracle.com&gt;
Message-Id: &lt;aa5ed3e62c27e881d0d8bc0acbc1572bc336dc19.1638817640.git.maciej.szmigiero@oracle.com&gt;
</content>
</entry>
<entry>
<title>KVM: MIPS: Drop pr_debug from memslot commit to avoid using "mem"</title>
<updated>2021-12-08T09:24:21Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2021-12-06T19:54:13Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3b1816177bfe2ce245a0f1194970644a79951570'/>
<id>urn:sha1:3b1816177bfe2ce245a0f1194970644a79951570</id>
<content type='text'>
Remove an old (circa 2012) kvm_debug from kvm_arch_commit_memory_region()
to print basic information when committing a memslot change.  The primary
motivation for removing the kvm_debug is to avoid using @mem, the user
memory region, so that said param can be removed.

Alternatively, the debug message could be converted to use @new, but that
would require synthesizing select state to play nice with the DELETED
case, which will pass NULL for @new in the future.  And there's no
argument to be had for dumping generic information in an arch callback,
i.e. if there's a good reason for the debug message, then it belongs in
common KVM code where all architectures can benefit.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Signed-off-by: Maciej S. Szmigiero &lt;maciej.szmigiero@oracle.com&gt;
Message-Id: &lt;446929a668f6e1346751571b71db41e94e976cdf.1638817639.git.maciej.szmigiero@oracle.com&gt;
</content>
</entry>
<entry>
<title>KVM: Let/force architectures to deal with arch specific memslot data</title>
<updated>2021-12-08T09:24:20Z</updated>
<author>
<name>Sean Christopherson</name>
<email>seanjc@google.com</email>
</author>
<published>2021-12-06T19:54:11Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=537a17b3149300987456e8949ccb991e604047d6'/>
<id>urn:sha1:537a17b3149300987456e8949ccb991e604047d6</id>
<content type='text'>
Pass the "old" slot to kvm_arch_prepare_memory_region() and force arch
code to handle propagating arch specific data from "new" to "old" when
necessary.  This is a baby step towards dynamically allocating "new" from
the get go, and is a (very) minor performance boost on x86 due to not
unnecessarily copying arch data.

For PPC HV, copy the rmap in the !CREATE and !DELETE paths, i.e. for MOVE
and FLAGS_ONLY.  This is functionally a nop as the previous behavior
would overwrite the pointer for CREATE, and eventually discard/ignore it
for DELETE.

For x86, copy the arch data only for FLAGS_ONLY changes.  Unlike PPC HV,
x86 needs to reallocate arch data in the MOVE case as the size of x86's
allocations depend on the alignment of the memslot's gfn.

Opportunistically tweak kvm_arch_prepare_memory_region()'s param order to
match the "commit" prototype.

Signed-off-by: Sean Christopherson &lt;seanjc@google.com&gt;
Reviewed-by: Maciej S. Szmigiero &lt;maciej.szmigiero@oracle.com&gt;
[mss: add missing RISCV kvm_arch_prepare_memory_region() change]
Signed-off-by: Maciej S. Szmigiero &lt;maciej.szmigiero@oracle.com&gt;
Message-Id: &lt;67dea5f11bbcfd71e3da5986f11e87f5dd4013f9.1638817639.git.maciej.szmigiero@oracle.com&gt;
</content>
</entry>
<entry>
<title>KVM: mips: Use kvm_get_vcpu() instead of open-coded access</title>
<updated>2021-12-08T09:24:13Z</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2021-11-16T16:03:58Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=75a9869f314d83ac70ebaa0b93773300681ab077'/>
<id>urn:sha1:75a9869f314d83ac70ebaa0b93773300681ab077</id>
<content type='text'>
As we are about to change the way vcpus are allocated, mandate
the use of kvm_get_vcpu() instead of open-coding the access.

Reviewed-by: Philippe Mathieu-Daudé &lt;f4bug@amsat.org&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Message-Id: &lt;20211116160403.4074052-3-maz@kernel.org&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: Move wiping of the kvm-&gt;vcpus array to common code</title>
<updated>2021-12-08T09:24:13Z</updated>
<author>
<name>Marc Zyngier</name>
<email>maz@kernel.org</email>
</author>
<published>2021-11-16T16:03:57Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=27592ae8dbe41033261b6fdf27d78998aabd2665'/>
<id>urn:sha1:27592ae8dbe41033261b6fdf27d78998aabd2665</id>
<content type='text'>
All architectures have similar loops iterating over the vcpus,
freeing one vcpu at a time, and eventually wiping the reference
off the vcpus array. They are also inconsistently taking
the kvm-&gt;lock mutex when wiping the references from the array.

Make this code common, which will simplify further changes.
The locking is dropped altogether, as this should only be called
when there is no further references on the kvm structure.

Reviewed-by: Claudio Imbrenda &lt;imbrenda@linux.ibm.com&gt;
Signed-off-by: Marc Zyngier &lt;maz@kernel.org&gt;
Message-Id: &lt;20211116160403.4074052-2-maz@kernel.org&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: MIPS: Cap KVM_CAP_NR_VCPUS by KVM_CAP_MAX_VCPUS</title>
<updated>2021-11-18T07:12:14Z</updated>
<author>
<name>Vitaly Kuznetsov</name>
<email>vkuznets@redhat.com</email>
</author>
<published>2021-11-16T16:34:39Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=57a2e13ebdda8b65602b44ec8b80e385603eb84c'/>
<id>urn:sha1:57a2e13ebdda8b65602b44ec8b80e385603eb84c</id>
<content type='text'>
It doesn't make sense to return the recommended maximum number of
vCPUs which exceeds the maximum possible number of vCPUs.

Signed-off-by: Vitaly Kuznetsov &lt;vkuznets@redhat.com&gt;
Message-Id: &lt;20211116163443.88707-3-vkuznets@redhat.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>kvm: rename KVM_MAX_VCPU_ID to KVM_MAX_VCPU_IDS</title>
<updated>2021-09-30T08:27:05Z</updated>
<author>
<name>Juergen Gross</name>
<email>jgross@suse.com</email>
</author>
<published>2021-09-13T13:57:44Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=a1c42ddedf35dbf5f25ea0982ed6e226eef7a78c'/>
<id>urn:sha1:a1c42ddedf35dbf5f25ea0982ed6e226eef7a78c</id>
<content type='text'>
KVM_MAX_VCPU_ID is not specifying the highest allowed vcpu-id, but the
number of allowed vcpu-ids. This has already led to confusion, so
rename KVM_MAX_VCPU_ID to KVM_MAX_VCPU_IDS to make its semantics more
clear

Suggested-by: Eduardo Habkost &lt;ehabkost@redhat.com&gt;
Signed-off-by: Juergen Gross &lt;jgross@suse.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Message-Id: &lt;20210913135745.13944-3-jgross@suse.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: stats: Support linear and logarithmic histogram statistics</title>
<updated>2021-08-20T20:06:32Z</updated>
<author>
<name>Jing Zhang</name>
<email>jingzhangos@google.com</email>
</author>
<published>2021-08-02T16:56:29Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=f95937ccf5bd5e0a6bbac2b8e65a87982ffae403'/>
<id>urn:sha1:f95937ccf5bd5e0a6bbac2b8e65a87982ffae403</id>
<content type='text'>
Add new types of KVM stats, linear and logarithmic histogram.
Histogram are very useful for observing the value distribution
of time or size related stats.

Signed-off-by: Jing Zhang &lt;jingzhangos@google.com&gt;
Message-Id: &lt;20210802165633.1866976-2-jingzhangos@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
<entry>
<title>KVM: debugfs: Reuse binary stats descriptors</title>
<updated>2021-06-24T22:00:29Z</updated>
<author>
<name>Jing Zhang</name>
<email>jingzhangos@google.com</email>
</author>
<published>2021-06-23T21:28:46Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=bc9e9e672df9f16f3825320c53ec01b3d44add28'/>
<id>urn:sha1:bc9e9e672df9f16f3825320c53ec01b3d44add28</id>
<content type='text'>
To remove code duplication, use the binary stats descriptors in the
implementation of the debugfs interface for statistics. This unifies
the definition of statistics for the binary and debugfs interfaces.

Signed-off-by: Jing Zhang &lt;jingzhangos@google.com&gt;
Message-Id: &lt;20210618222709.1858088-8-jingzhangos@google.com&gt;
Signed-off-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
</content>
</entry>
</feed>
