All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm-devel <kvm@vger.kernel.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	pagupta@redhat.com
Subject: Re: [PATCH] KVM: x86: remove irq disablement around KVM_SET_CLOCK/KVM_GET_CLOCK
Date: Wed, 12 Apr 2017 19:40:51 +0200	[thread overview]
Message-ID: <20170412174051.GB23556@potion> (raw)
In-Reply-To: <20170412172313.GA26589@amt.cnet>

2017-04-12 14:23-0300, Marcelo Tosatti:
> The disablement of interrupts at KVM_SET_CLOCK/KVM_GET_CLOCK 
> attempts to disable interrupts in that section to protect
> the values that are calculated in that section from interrupt interference. 
> 
> now_ns is calculated inside the irq protected region, 
> user_ns.clock is passed from userspace (therefore not susceptible
> to interrupt variation).
> 
> About the line
>                 now_ns = __get_kvmclock_ns(kvm);  (1)
> 
> Interrupts can happen afterwards local_irq_enable(), 
> rendering "now_ns" relative to its execution time PLUS 
> interrupt time.
> 
> Therefore the local_irq_disable() / local_irq_enable() protection is not
> necessary (that is: interrupts triggering after local_irq_enable cause
> the same problem that the protection is trying to avoid).

Makes sense.

get_kvmclock_ns() has the same problem and this patch should cover it as
well.

  reply	other threads:[~2017-04-12 17:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-12 17:23 [PATCH] KVM: x86: remove irq disablement around KVM_SET_CLOCK/KVM_GET_CLOCK Marcelo Tosatti
2017-04-12 17:40 ` Radim Krčmář [this message]
2017-04-13  6:06 ` Pankaj Gupta
2017-04-13 18:30   ` Marcelo Tosatti
2017-04-13 18:49   ` [PATCH v2] " Marcelo Tosatti
2017-04-17 11:05     ` Pankaj Gupta
2017-04-17 15:51       ` [PATCH v3] " Marcelo Tosatti
2017-04-18  5:06         ` Pankaj Gupta
2017-04-21 10:04         ` Paolo Bonzini
2017-04-13  7:32 ` [PATCH] " Roman Kagan
2017-04-13 13:27   ` Radim Krčmář

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170412174051.GB23556@potion \
    --to=rkrcmar@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=pagupta@redhat.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.