From: Toshi Kani <toshi.kani@hp.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, X86 ML <x86@kernel.org>,
Borislav Petkov <bp@alien8.de>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-nvdimm@lists.01.org" <linux-nvdimm@ml01.01.org>
Subject: Re: [PATCH] x86/panic/reboot: Flush processor caches during panic/reboot
Date: Thu, 23 Jul 2015 12:09:01 -0600 [thread overview]
Message-ID: <1437674941.3214.325.camel@hp.com> (raw)
In-Reply-To: <CAPcyv4j76ToWdgjEb+r35Mq_ucPEqnD8izQef82M1NkxbEXHQw@mail.gmail.com>
On Thu, 2015-07-23 at 10:40 -0700, Dan Williams wrote:
> On Thu, Jul 23, 2015 at 10:33 AM, Toshi Kani <toshi.kani@hp.com> wrote:
> > During power failure, Asynchronous DRAM Refresh (ADR) flushes
> > the write buffer in memory controllers into NVDIMM, but does not
> > flush processor caches. While the kernel and application code
> > need to take care of processor cache flush, they may not be able
> > to do so during panic or reboot.
> >
> > Add processor cache flush (wbinvd) to the stop-CPUs interfaces,
> > native_stop_other_cpus() and nmi_shootdown_cpus(), which are
> > called during panic and reboot as follows. These wbinvd()s are
> > called on each CPU after its irq/APIC is disabled.
> >
> > - panic()
> > + smp_send_stop()
> > o native_stop_other_cpus()
> > o stop_this_cpu()
> >
> > - native_machine_restart()
> > - native_machine_halt()
> > - native_machine_power_off()
> > + native_machine_shutdown()
> > + stop_other_cpus()
> > o native_stop_other_cpus()
> > o stop_this_cpu()
> >
> > - native_machine_crash_shutdown()
> > + kdump_nmi_shootdown_cpus()
> > o nmi_shootdown_cpus()
> > o crash_nmi_callback()
> >
> > Note, the cpu offline path, mwait_play_dead(), already calls
> > wbinvd().
> >
>
> If the application is already prepared for surprise power loss what
> additional benefit is there to flushing caches on panic? In other
> words, if the application needs this for correctness then it is broken
> with respect to surprise power loss, otherwise these flushes are not
> necessary.
I agree that well-written applications should withstand with their own
journaling mechanisms whey they access NVDIMM directly. But not all
applications are well-written or perfect on this regard. msync does not
flush processor caches at this point, either. So, we want to save all
updates to NVDIMM as much as possible to minimize inconsistency.
Thanks,
-Toshi
prev parent reply other threads:[~2015-07-23 18:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-23 17:33 [PATCH] x86/panic/reboot: Flush processor caches during panic/reboot Toshi Kani
2015-07-23 17:40 ` Dan Williams
2015-07-23 18:09 ` Toshi Kani [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=1437674941.3214.325.camel@hp.com \
--to=toshi.kani@hp.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@ml01.01.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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