OGAWA Hirofumi | 1 May 2011 03:45
Picon

Re: nmi is broken?

OGAWA Hirofumi <hirofumi <at> mail.parknet.co.jp> writes:

>>> That is correct, kvm doesn't connect the master 8259 output to the 
>>> IOAPIC.  Instead the 8259 is connected to LINT0 (which is configured for 
>>> ExtInt when the IOAPIC is disabled, or for NMI which the NMI watchdog is 
>>> enabled).
>>>
>>> However, now I can't see how it would work. auto EOI works on the INTA 
>>> cycle, which would only occur if LINT0 is configured for ExtInt.  If it 
>>> is configured for NMI, I don't think it would issue the INTA cycle.  So 
>>> the NMI watchdog not working is actually correct for our hardware 
>>> configuration!
>>>
>>> But I may be misunderstanding something here.
>>
>> I see. If the physical machine was configured as above, I guess (not
>> pretty sure, I don't have this configuration machine), IOAPIC test
>> (check_timer() in io_apic.c) should fail, and IOAPIC wouldn't have any
>> effect. And I think MADT should tell mp_ExtINT.
>>
>> Yes, I also guess the above configuration wouldn't work NMI watchdog of
>> IOAPIC mode, and linux will report as NMI watchdog can't work in
>> check_timer().
>
> Hm.., if smp was enabled, what configuration model is used by kvm? I
> think this configuration model can't work on smp.

As far as I can see, kvm is not configured (from MADT and some of
behaviors) like you said.

(Continue reading)

Takuya Yoshikawa | 1 May 2011 07:30
Picon

[PATCH 0/1 v2] KVM: MMU: Use ptep_user for cmpxchg_gpte()

Changelog v1->v2:
  Added error handling for get_user_pages_fast() failure

Tested with NPT off:

  paging64_walk_addr_generic() {
    get_cr3();
    translate_gpa();
    gfn_to_hva();
    kvm_is_error_hva();
    _cond_resched();
    translate_gpa();
    gfn_to_hva();
    kvm_is_error_hva();
    _cond_resched();
    translate_gpa();
    gfn_to_hva();
    kvm_is_error_hva();
    _cond_resched();
    translate_gpa();
    gfn_to_hva();
    kvm_is_error_hva();
    _cond_resched();
    paging64_cmpxchg_gpte() {
      get_user_pages_fast() {
        gup_pud_range() {
          gup_pte_range();
        }
      }
      kvm_release_page_dirty() {
(Continue reading)

Takuya Yoshikawa | 1 May 2011 07:33
Picon

[PATCH 1/1 v2] KVM: MMU: Use ptep_user for cmpxchg_gpte()

From: Takuya Yoshikawa <yoshikawa.takuya <at> oss.ntt.co.jp>

The address of the gpte was already calculated and stored in ptep_user
before entering cmpxchg_gpte().

This patch makes cmpxchg_gpte() to use that to make it clear that we
are using the same address during walk_addr_generic().

Note that the unlikely annotations are used to show that the conditions
are something unusual rather than for performance.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya <at> oss.ntt.co.jp>
---
 arch/x86/kvm/paging_tmpl.h |   26 ++++++++++++--------------
 1 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 52450a6..f9d9af1 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
 <at>  <at>  -79,21 +79,19  <at>  <at>  static gfn_t gpte_to_gfn_lvl(pt_element_t gpte, int lvl)
 }

 static int FNAME(cmpxchg_gpte)(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu,
-			 gfn_t table_gfn, unsigned index,
-			 pt_element_t orig_pte, pt_element_t new_pte)
+			       pt_element_t __user *ptep_user, unsigned index,
+			       pt_element_t orig_pte, pt_element_t new_pte)
 {
+	int npages;
(Continue reading)

Pekka Enberg | 1 May 2011 09:10
Gravatar

Re: [PATCH 1/3] kvm tools: Lock job_mutex before signalling

On Sat, 2011-04-30 at 16:30 +0300, Sasha Levin wrote:
> Locking mutex before signalling to prevent unexpected
> scheduling.
> 
> Signed-off-by: Sasha Levin <levinsasha928 <at> gmail.com>

Yeah, I think we need to do this but the changelog is not really
adequate for this kind of change. Care to elaborate more why it's
needed?

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Sasha Levin | 1 May 2011 09:43
Picon

Re: [PATCH 1/3] kvm tools: Lock job_mutex before signalling

On Sun, 2011-05-01 at 10:10 +0300, Pekka Enberg wrote:
> On Sat, 2011-04-30 at 16:30 +0300, Sasha Levin wrote:
> > Locking mutex before signalling to prevent unexpected
> > scheduling.
> > 
> > Signed-off-by: Sasha Levin <levinsasha928 <at> gmail.com>
> 
> Yeah, I think we need to do this but the changelog is not really
> adequate for this kind of change. Care to elaborate more why it's
> needed?
> 

By holding the mutex while signaling, we can expect predictable
scheduling between the worker threads. This will make debugging various
thread pool related issues much easier (and maybe solve some obscure
bugs too).

--

-- 

Sasha.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Avi Kivity | 1 May 2011 15:32
Picon
Favicon

Re: [RFC PATCH 3/3] KVM: MMU: Optimize guest page table walk

On 04/29/2011 07:05 PM, Andi Kleen wrote:
> >  Do you think the following case would not differ so much
> >  from (1' 2') ?
> >
> >  walk_addr_generic()              ---1''
> >    copy_from_user()               ---2''
>
> Yes it should be the same and is cleaner.
>
> If you do a make .../foo.i and look at the code coming out of the
> preprocessor you'll see it expands to a
>
> 	if (!__builtin_constant_p(size))
>                  return copy_user_generic(dst, (__force void *)src, size);
>          switch (size) {
>          case 1:__get_user_asm(*(u8 *)dst, (u8 __user *)src,
>                                ret, "b", "b", "=q", 1);
>                  return ret;
> 	case 2: ..
> 	case 4: ..
> 	case 8: ..
> 	case 10: ..
> 	case 16: ..
> 	}
>
> Ok it looks like the 32bit kernel only handles 1/2/4. Maybe that
> was the problem if you ran on 32bit.

I'm happy with a slower copy_from_user() for that particular case.

(Continue reading)

Takuya Yoshikawa | 1 May 2011 19:21
Picon

[PATCH 0/6] KVM: x86 emulator: Unused opt removal and some cleanups

Patches 0-4: Just remove unused opt
Patch 5: grpX emulation cleanup
Patch 6: jmp far emulation cleanup

Some functions introduced in patch 5/6 will be called by
opcode::execute later.

Takuya
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Takuya Yoshikawa | 1 May 2011 19:23
Picon

[PATCH 1/6] KVM: x86 emulator: Remove unused opt from seg_override()

From: Takuya Yoshikawa <yoshikawa.takuya <at> oss.ntt.co.jp>

In addition, one comma at the end of a statement is replaced with a
semicolon.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya <at> oss.ntt.co.jp>
---
 arch/x86/kvm/emulate.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index a8faf8d..1545092 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
 <at>  <at>  -500,7 +500,6  <at>  <at>  static unsigned long seg_base(struct x86_emulate_ctxt *ctxt,
 }

 static unsigned seg_override(struct x86_emulate_ctxt *ctxt,
-			     struct x86_emulate_ops *ops,
 			     struct decode_cache *c)
 {
 	if (!c->has_seg_override)
 <at>  <at>  -3527,7 +3526,7  <at>  <at>  done_prefixes:
 	if (!c->has_seg_override)
 		set_seg_override(c, VCPU_SREG_DS);

-	memop.addr.mem.seg = seg_override(ctxt, ops, c);
+	memop.addr.mem.seg = seg_override(ctxt, c);

 	if (memop.type == OP_MEM && c->ad_bytes != 8)
(Continue reading)

Takuya Yoshikawa | 1 May 2011 19:25
Picon

[PATCH 2/6] KVM: x86 emulator: Remove unused opt from read_descriptor()

From: Takuya Yoshikawa <yoshikawa.takuya <at> oss.ntt.co.jp>

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya <at> oss.ntt.co.jp>
---
 arch/x86/kvm/emulate.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 1545092..72b268e 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
 <at>  <at>  -729,7 +729,6  <at>  <at>  static void *decode_register(u8 modrm_reg, unsigned long *regs,
 }

 static int read_descriptor(struct x86_emulate_ctxt *ctxt,
-			   struct x86_emulate_ops *ops,
 			   struct segmented_address addr,
 			   u16 *size, unsigned long *address, int op_bytes)
 {
 <at>  <at>  -2720,7 +2719,7  <at>  <at>  static int em_lgdt(struct x86_emulate_ctxt *ctxt)
 	struct desc_ptr desc_ptr;
 	int rc;

-	rc = read_descriptor(ctxt, ctxt->ops, c->src.addr.mem,
+	rc = read_descriptor(ctxt, c->src.addr.mem,
 			     &desc_ptr.size, &desc_ptr.address,
 			     c->op_bytes);
 	if (rc != X86EMUL_CONTINUE)
 <at>  <at>  -2749,9 +2748,8  <at>  <at>  static int em_lidt(struct x86_emulate_ctxt *ctxt)
 	struct desc_ptr desc_ptr;
(Continue reading)

Takuya Yoshikawa | 1 May 2011 19:26
Picon

[PATCH 3/6] KVM: x86 emulator: Remove unused opt from writeback()

From: Takuya Yoshikawa <yoshikawa.takuya <at> oss.ntt.co.jp>

Remove inline at this chance.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya <at> oss.ntt.co.jp>
---
 arch/x86/kvm/emulate.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 72b268e..5ed358f 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
 <at>  <at>  -1351,8 +1351,7  <at>  <at>  static void write_register_operand(struct operand *op)
 	}
 }

-static inline int writeback(struct x86_emulate_ctxt *ctxt,
-			    struct x86_emulate_ops *ops)
+static int writeback(struct x86_emulate_ctxt *ctxt)
 {
 	int rc;
 	struct decode_cache *c = &ctxt->decode;
 <at>  <at>  -4089,7 +4088,7  <at>  <at>  special_insn:
 		goto done;

 writeback:
-	rc = writeback(ctxt, ops);
+	rc = writeback(ctxt);
 	if (rc != X86EMUL_CONTINUE)
(Continue reading)


Gmane