[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PCI memory sync question (kvm,dpdk,e1000,packet stalled)
From: |
Stefan Hajnoczi |
Subject: |
Re: PCI memory sync question (kvm,dpdk,e1000,packet stalled) |
Date: |
Thu, 21 Nov 2019 14:05:02 +0000 |
User-agent: |
Mutt/1.12.1 (2019-06-15) |
On Wed, Nov 20, 2019 at 08:36:32PM +0300, ASM wrote:
> I trying solve the problem, with packets stopping (e1000,tap,kvm).
> My studies led to the following:
> 1. From flatview_write_continue() I see, what e1000 writes the number
> "7" to the STAT register.
> 2. The driver from target OS reads STAT register with number "7" and
> writes to the register the number "0".
> 3. From flatview_write_continue() (I make edits):
> memcpy(ptr, buf, l);
> new1=ptr[0xc];
> usleep(100);
> new2=ptr[0xc];
> invalidate_and_set_dirty(mr, addr1, l);
> new3=ptr[0xc];
> printf("Old: %i, new1, %i, new2: %i, new3: %i\n", old,new1,new2,new3);
>
> I see what memory in first printf is "7", but after usleep() is "0".
> Do I understand correctly that this should not be? Or RCU lock
> suggests the ability to the multiple writers?
>
> The problem is that qemu(e1000) writes the number 7, after which
> target(dpdk driver) reads 7, on the basis of this it writes the number
> 0, but as a result (extremely rarely), the value STATUS still remains
> 7. Therefore, packet processing is interrupted. This behavior is
> observed only on kvm (it is not observed on tcg).
>
> Please help with advice or ideas.
Hi Leonid,
Could you be seeing weird behavior with KVM due to MMIO write
coalescing?
static void e1000_mmio_setup(E1000State *d)
{
int i;
const uint32_t excluded_regs[] = {
E1000_MDIC, E1000_ICR, E1000_ICS, E1000_IMS,
E1000_IMC, E1000_TCTL, E1000_TDT, PNPMMIO_SIZE
};
memory_region_init_io(&d->mmio, OBJECT(d), &e1000_mmio_ops, d,
"e1000-mmio", PNPMMIO_SIZE);
memory_region_add_coalescing(&d->mmio, 0, excluded_regs[0]);
for (i = 0; excluded_regs[i] != PNPMMIO_SIZE; i++)
memory_region_add_coalescing(&d->mmio, excluded_regs[i] + 4,
excluded_regs[i+1] - excluded_regs[i] -
4);
memory_region_init_io(&d->io, OBJECT(d), &e1000_io_ops, d, "e1000-io",
IOPORT_SIZE);
}
MMIO write coalescing means that QEMU doesn't see the register writes
immediately. Instead kvm.ko records them into a ring buffer and QEMU
processes the ring when the next ioctl(KVM_RUN) exit occurs.
See Linux Documentation/virt/kvm/api.txt "4.116
KVM_(UN)REGISTER_COALESCED_MMIO" for more details.
I don't really understand your printf debugging explanation. It would
help to see the DPDK code and the exact printf() output.
Also, is DPDK accessing the e1000 device from more than 1 vCPU?
Stefan
signature.asc
Description: PGP signature