From: zhangzhiqiang <zhangzhiqiang.zhang@huawei.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: <stable@vger.kernel.org>, <gregkh@linuxfoundation.org>,
<mingo@kernel.org>, <morgan.wang@huawei.com>
Subject: Re: [PATCH] perf/x86: Further optimize copy_from_user_nmi()
Date: Tue, 19 May 2015 19:18:27 +0800 [thread overview]
Message-ID: <555B1C03.4040801@huawei.com> (raw)
In-Reply-To: <20150519073906.GC19282@twins.programming.kicks-ass.net>
On 2015/5/19 15:39, Peter Zijlstra wrote:
> On Tue, May 19, 2015 at 12:08:39PM +0800, Zhiqiang Zhang wrote:
>> commit e00b12e64be9a34ef071de7b6052ca9ea29dd460 upstream
>>
>> Now that we can deal with nested NMI due to IRET re-enabling NMIs and
>> can deal with faults from NMI by making sure we preserve CR2 over NMIs
>> we can in fact simply access user-space memory from NMI context.
>>
>> So rewrite copy_from_user_nmi() to use __copy_from_user_inatomic() and
>> rework the fault path to do the minimal required work before taking
>> the in_atomic() fault handler.
>>
>> In particular avoid perf_sw_event() which would make perf recurse on
>> itself (it should be harmless as our recursion protections should be
>> able to deal with this -- but why tempt fate).
>>
>> Also rename notify_page_fault() to kprobes_fault() as that is a much
>> better name; there is no notifier in it and its specific to kprobes.
>>
>> Don measured that his worst case NMI path shrunk from ~300K cycles to
>> ~150K cycles.
>>
>> Cc: Stephane Eranian <eranian@google.com>
>> Cc: jmario@redhat.com
>> Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
>> Cc: Linus Torvalds <torvalds@linux-foundation.org>
>> Cc: Andi Kleen <ak@linux.intel.com>
>> Cc: dave.hansen@linux.intel.com
>> Tested-by: Don Zickus <dzickus@redhat.com>
>> Signed-off-by: Peter Zijlstra <peterz@infradead.org>
>> Link: http://lkml.kernel.org/r/20131024105206.GM2490@laptop.programming.kicks-ass.net
>> Signed-off-by: Ingo Molnar <mingo@kernel.org>
>> [zhangzhiqiang: backport to 3.10:
>
> Did you make sure all the nested NMI fixes are in 3.10?
>
> .
>
Sorry, i am not quite sure about that, i just using it fixes page fault from PMI.
I will looking farther carefully.
thanks very much.
prev parent reply other threads:[~2015-05-19 11:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-19 4:08 [PATCH] perf/x86: Further optimize copy_from_user_nmi() Zhiqiang Zhang
2015-05-19 7:39 ` Peter Zijlstra
2015-05-19 11:18 ` zhangzhiqiang [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=555B1C03.4040801@huawei.com \
--to=zhangzhiqiang.zhang@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=mingo@kernel.org \
--cc=morgan.wang@huawei.com \
--cc=peterz@infradead.org \
--cc=stable@vger.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 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.