Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753166Ab2HYBt1 (ORCPT ); Fri, 24 Aug 2012 21:49:27 -0400 Received: from mail-vb0-f46.google.com ([209.85.212.46]:49341 "EHLO mail-vb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751005Ab2HYBtY (ORCPT ); Fri, 24 Aug 2012 21:49:24 -0400 MIME-Version: 1.0 In-Reply-To: References: <1345852516-3125-1-git-send-email-jacob.shin@amd.com> <1345852516-3125-2-git-send-email-jacob.shin@amd.com> Date: Fri, 24 Aug 2012 18:49:23 -0700 X-Google-Sender-Auth: 0nNxQ0O35lHjFO_4KUAn9CsBySY Message-ID: Subject: Re: [PATCH 1/5] x86: Move enabling of PSE and PGE out of init_memory_mapping From: Yinghai Lu To: Jacob Shin Cc: X86-ML , LKML , "H. Peter Anvin" , Tejun Heo , Dave Young , Chao Wang , Vivek Goyal , Andreas Herrmann , Borislav Petkov Content-Type: multipart/mixed; boundary=bcaec501605746fcbb04c80d4dfc Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 8187 Lines: 141 --bcaec501605746fcbb04c80d4dfc Content-Type: text/plain; charset=ISO-8859-1 On Fri, Aug 24, 2012 at 6:25 PM, Yinghai Lu wrote: > On Fri, Aug 24, 2012 at 4:55 PM, Jacob Shin wrote: >> Depending on the platform, init_memory_mapping() may be called multiple >> times. Move it out to setup_arch() to avoid writing to cr4 on every call. >> >> Signed-off-by: Jacob Shin >> --- >> arch/x86/kernel/setup.c | 10 ++++++++++ >> arch/x86/mm/init.c | 10 ---------- >> 2 files changed, 10 insertions(+), 10 deletions(-) >> >> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c >> index f4b9b80..751e020 100644 >> --- a/arch/x86/kernel/setup.c >> +++ b/arch/x86/kernel/setup.c >> @@ -913,6 +913,16 @@ void __init setup_arch(char **cmdline_p) >> >> init_gbpages(); >> >> + /* Enable PSE if available */ >> + if (cpu_has_pse) >> + set_in_cr4(X86_CR4_PSE); >> + >> + /* Enable PGE if available */ >> + if (cpu_has_pge) { >> + set_in_cr4(X86_CR4_PGE); >> + __supported_pte_mask |= _PAGE_GLOBAL; >> + } >> + > > please don't put it directly in setup_arch(). > > and another function. > Jacob, hpa can you use attached one to replace the first patch? Thanks Yinghai --bcaec501605746fcbb04c80d4dfc Content-Type: application/octet-stream; name="get_page_size_mask.patch" Content-Disposition: attachment; filename="get_page_size_mask.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_h6a1wf740 U3ViamVjdDogW1BBVENIIDEvM10geDg2LCBtbTogIEludHJvZHVjZSBnbG9iYWwgcGFnZV9zaXpl X21hc2sKCkFkZCBwcm9iZV9wYWdlX3NpemVfbWFzaygpIHRvIGRldGVjdCBpZiBuZWVkIHRvIHVz ZSAxRyBvciAyTS4KYW5kIHN0b3JlIHRoZW0gaW4gcGFnZV9zaXplX21hc2suCgpPbmx5IHByb2Jl IHRoZW0gYXQgZmlyc3QgaW5pdF9tZW1vcnlfbWFwcGluZyBjYWxsaW5nLgpzZWNvbmQgYW5kIGxh dGVyIGluaXRfbWVtb3J5X21hcHBpbmcoKSBjYWxsaW5nIGRvZXMgbm90IG5lZWQgcHJvYmUgYWdh aW4uCmFsc28gd2UgZG9uJ3QgbmVlZCB0byBwYXNzIHVzZV9nYnBhZ2VzIGFyb3VuZC4KClN1Z2dl c3RlZC1ieTogSW5nbyBNb2xuYXIgPG1pbmdvQGVsdGUuaHU+ClNpZ25lLW9mZi1ieTogWWluZ2hh aSBMdSA8eWluZ2hhaUBrZXJuZWwub3JnPgoKLS0tCiBhcmNoL3g4Ni9pbmNsdWRlL2FzbS9wZ3Rh YmxlLmggfCAgICAxIAogYXJjaC94ODYvbW0vaW5pdC5jICAgICAgICAgICAgIHwgICA3MCArKysr KysrKysrKysrKysrKysrKystLS0tLS0tLS0tLS0tLS0tLS0tLQogMiBmaWxlcyBjaGFuZ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lX3NwYWNlKCZtclswXSwgZW5kKTsKIAogCWZvciAoaSA9 IDA7IGkgPCBucl9yYW5nZTsgaSsrKQogCQlyZXQgPSBrZXJuZWxfcGh5c2ljYWxfbWFwcGluZ19p bml0KG1yW2ldLnN0YXJ0LCBtcltpXS5lbmQsCg== --bcaec501605746fcbb04c80d4dfc-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/