qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrzej Jakowski <andrzej.jakowski@linux.intel.com>
To: Stefan Hajnoczi <stefanha@gmail.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
	Haozhong Zhang <haozhong.zhang@intel.com>,
	qemu block <qemu-block@nongnu.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	Dave Gilbert <dgilbert@redhat.com>,
	kbusch@kernel.org, Zhang Yi <yi.z.zhang@linux.intel.com>,
	"He, Junyan" <junyan.he@intel.com>,
	Klaus Birkelund Jensen <its@irrelevant.dk>,
	Max Reitz <mreitz@redhat.com>
Subject: Re: [PATCH RESEND v2] block/nvme: introduce PMR support from NVMe 1.4 spec
Date: Tue, 17 Mar 2020 21:20:32 -0700	[thread overview]
Message-ID: <eaeefd2d-fa51-8141-e53d-fa9cee2ca1f3@linux.intel.com> (raw)
In-Reply-To: <CAJSP0QUmO2sbCscL=f+=Ps8Wud5vcxWmL0U64Jy7XJ7VPuQGFA@mail.gmail.com>

On 3/17/20 4:23 AM, Stefan Hajnoczi wrote:
>> Code is posted here
>> https://github.com/AndrzejJakowski/qemu/commit/3a7762a1d13ff1543d1da430748eb24e38faab6f
>>
>> QEMU command line:
>>
>> # below are just relevant pieces of configuration, other stuff omitted
>> # tried different setting (e.g. pmem=on and pmem=off)
>>
>> ./x86_64-softmmu/qemu-system-x86_64 ... \
>> -object memory-backend-file,id=mem1,share=off,pmem=on,mem-path=../nvme_pmr.bin,size=$((1*1024*1024)) \
> share=off is MAP_PRIVATE.  If persistence is desired then share=on
> should be used.
> 
> However, this shouldn't affect "system_reset" behavior since the QEMU
> process still has the same mapped file open.
> 

Hi Stefan,

Thx!! share=off setting was the problem. I confirmed with my simple test
that persistence is achieved.
I didn't find API to perform flush (msync). Any suggestion what function to use?

Given that host memory backend is working I think my patch is almost ready for 
resubmission -- let me know if there are any other comments.

Andrzej

>> -drive file=../nvme.bin,format=raw,if=none,id=nvme_emulated \
>> -device nvme,drive=nvme_emulated,serial="test serial",pmrdev=mem1
>>
>> In VM:
>> My persisent memory region is exposed PCI BAR
>> Region 2: Memory at fe000000 (64-bit, prefetchable) [size=1M]
>>
>> So I perform reads/writes from/to following adress 0xfe000000 (decimal 4261412864)
>>
>> dd if=test.bin of=/dev/mem bs=1 count=30 seek=4261412864
>> dd if=/dev/mem of=test1.bin bs=1 count=30 skip=4261412864
> Did you verify that the guest kernel is really accessing the BAR?  I
> remember that distro kernels often ship with options that make
> /dev/mem of limited use because it's considered insecure.
> 
>> On VMM I didn't observe that backing file has been updated and after power cycling VM
>> I see old junk when reading PMR region.
> Did you check that the pmrdev mmap region contains the data the guest
> wrote before power cycling?
> 
>> Also from include/qemu/pmem.h it looks like pmem_persist() will cause qemu to exit
>> if libpmem is not installed:
> The libpmem support only needs to be used when the pmem=on option was
> given.  If there isn't a physical pmem device then it doesn't need to
> be used.
> 
> Stefan



      reply	other threads:[~2020-03-18  4:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-06 22:38 [PATCH RESEND v2] block/nvme: introduce PMR support from NVMe 1.4 spec Andrzej Jakowski
2020-03-10  9:51 ` Stefan Hajnoczi
2020-03-10 20:09   ` Andrzej Jakowski
2020-03-11  9:20     ` Stefan Hajnoczi
2020-03-11 22:54       ` Andrzej Jakowski
2020-03-12  6:08         ` Klaus Birkelund Jensen
2020-03-16 11:32           ` Stefan Hajnoczi
2020-03-16 17:10             ` Andrzej Jakowski
2020-03-17 11:23               ` Stefan Hajnoczi
2020-03-18  4:20                 ` Andrzej Jakowski [this message]

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=eaeefd2d-fa51-8141-e53d-fa9cee2ca1f3@linux.intel.com \
    --to=andrzej.jakowski@linux.intel.com \
    --cc=dgilbert@redhat.com \
    --cc=haozhong.zhang@intel.com \
    --cc=its@irrelevant.dk \
    --cc=junyan.he@intel.com \
    --cc=kbusch@kernel.org \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    --cc=yi.z.zhang@linux.intel.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 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).