kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Reason for extra struct kvm_run parameter in MMIO handling?
@ 2015-02-06 17:30 Andre Przywara
  2015-02-09 16:21 ` Radim Krčmář
  0 siblings, 1 reply; 4+ messages in thread
From: Andre Przywara @ 2015-02-06 17:30 UTC (permalink / raw)
  To: kvm@vger.kernel.org, Paolo Bonzini, Gleb Natapov
  Cc: kvmarm@lists.cs.columbia.edu

Hi,

while reworking the ARM vGIC emulation layer to use the kvm_io_bus
framework, I wonder why the whole KVM MMIO handling always passes the
pointer to struct kvm_run along with the struct kvm_vcpu pointer.
As kvm_run is a member of kvm_vcpu, the vcpu alone should be sufficient,
right?
Also I see the very top of the call chain is effectively:
kvm_arch_vcpu_ioctl_run(vcpu, vcpu->run);

So is that just legacy code still lingering around from the dawn of time
and nobody dared to rework this or is there a particular reason for
doing so?

I am asking because I lack the kvm_run pointer in the MMIO handler, so I
just use vcpu->run and I wonder if there are potential issues in doing so.

Cheers,
Andre.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reason for extra struct kvm_run parameter in MMIO handling?
  2015-02-06 17:30 Reason for extra struct kvm_run parameter in MMIO handling? Andre Przywara
@ 2015-02-09 16:21 ` Radim Krčmář
  2015-02-09 16:26   ` Paolo Bonzini
  0 siblings, 1 reply; 4+ messages in thread
From: Radim Krčmář @ 2015-02-09 16:21 UTC (permalink / raw)
  To: Andre Przywara
  Cc: kvm@vger.kernel.org, Paolo Bonzini, Gleb Natapov,
	kvmarm@lists.cs.columbia.edu

2015-02-06 17:30+0000, Andre Przywara:
> As kvm_run is a member of kvm_vcpu, the vcpu alone should be sufficient,
> right?

Yes.

> Also I see the very top of the call chain is effectively:
> kvm_arch_vcpu_ioctl_run(vcpu, vcpu->run);

:(

> So is that just legacy code still lingering around from the dawn of time
> and nobody dared to rework this or is there a particular reason for
> doing so?

Probably laziness in 9a2bb7f486dc639a1cf2ad803bf2227f0dc0809d.

> I am asking because I lack the kvm_run pointer in the MMIO handler, so I
> just use vcpu->run and I wonder if there are potential issues in doing so.

We do it at few places already, so there, hopefully, is no problem.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reason for extra struct kvm_run parameter in MMIO handling?
  2015-02-09 16:21 ` Radim Krčmář
@ 2015-02-09 16:26   ` Paolo Bonzini
  2015-02-09 17:22     ` Andre Przywara
  0 siblings, 1 reply; 4+ messages in thread
From: Paolo Bonzini @ 2015-02-09 16:26 UTC (permalink / raw)
  To: Radim Krčmář, Andre Przywara
  Cc: kvm@vger.kernel.org, Gleb Natapov, kvmarm@lists.cs.columbia.edu



On 09/02/2015 17:21, Radim Krčmář wrote:
> > So is that just legacy code still lingering around from the dawn of time
> > and nobody dared to rework this or is there a particular reason for
> > doing so?
> 
> Probably laziness in 9a2bb7f486dc639a1cf2ad803bf2227f0dc0809d.

Or microoptimization.  Laziness is more likely though.

> > I am asking because I lack the kvm_run pointer in the MMIO handler, so I
> > just use vcpu->run and I wonder if there are potential issues in doing so.
>
> We do it at few places already, so there, hopefully, is no problem.

Yup.  Thanks Radim for answering!

Paolo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Reason for extra struct kvm_run parameter in MMIO handling?
  2015-02-09 16:26   ` Paolo Bonzini
@ 2015-02-09 17:22     ` Andre Przywara
  0 siblings, 0 replies; 4+ messages in thread
From: Andre Przywara @ 2015-02-09 17:22 UTC (permalink / raw)
  To: Paolo Bonzini, Radim Krčmář
  Cc: kvm@vger.kernel.org, Gleb Natapov, kvmarm@lists.cs.columbia.edu

Radim, Paolo,

On 09/02/15 16:26, Paolo Bonzini wrote:
> On 09/02/2015 17:21, Radim Krčmář wrote:
>>> So is that just legacy code still lingering around from the dawn of time
>>> and nobody dared to rework this or is there a particular reason for
>>> doing so?
>>
>> Probably laziness in 9a2bb7f486dc639a1cf2ad803bf2227f0dc0809d.
> 
> Or microoptimization.  Laziness is more likely though.
> 
>>> I am asking because I lack the kvm_run pointer in the MMIO handler, so I
>>> just use vcpu->run and I wonder if there are potential issues in doing so.
>>
>> We do it at few places already, so there, hopefully, is no problem.
> 
> Yup.  Thanks Radim for answering!

thanks for the answer and the confirmation!
Looks like I don't dare to write a patch for that ;-)

Cheers,
Andre.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-09 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06 17:30 Reason for extra struct kvm_run parameter in MMIO handling? Andre Przywara
2015-02-09 16:21 ` Radim Krčmář
2015-02-09 16:26   ` Paolo Bonzini
2015-02-09 17:22     ` Andre Przywara

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).