Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751912Ab2BUF2V (ORCPT ); Tue, 21 Feb 2012 00:28:21 -0500 Received: from mail-wi0-f174.google.com ([209.85.212.174]:56691 "EHLO mail-wi0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751394Ab2BUF2R (ORCPT ); Tue, 21 Feb 2012 00:28:17 -0500 Authentication-Results: mr.google.com; spf=pass (google.com: domain of linus971@gmail.com designates 10.180.92.229 as permitted sender) smtp.mail=linus971@gmail.com; dkim=pass header.i=linus971@gmail.com MIME-Version: 1.0 In-Reply-To: <4F42FE08.5020309@zytor.com> References: <4F42FE08.5020309@zytor.com> From: Linus Torvalds Date: Mon, 20 Feb 2012 21:27:56 -0800 X-Google-Sender-Auth: yu1yV_DSjU_qxC51cCKETPxyWFg Message-ID: Subject: Re: [PATCH v2 3/3] i387: support lazy restore of FPU state To: "H. Peter Anvin" Cc: Josh Boyer , Jongman Heo , Thomas Gleixner , Ingo Molnar , x86@kernel.org, Linux Kernel Mailing List Content-Type: multipart/mixed; boundary=f46d043c094e92862f04b972ad2f Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 9446 Lines: 145 --f46d043c094e92862f04b972ad2f Content-Type: text/plain; charset=ISO-8859-1 On Mon, Feb 20, 2012 at 6:14 PM, H. Peter Anvin wrote: > On 02/20/2012 06:10 PM, Linus Torvalds wrote: >> >> Although I do wonder if we should just make kernel_fpu_begin() be a >> real function instead of inlining it. I'm not sure it makes sense to >> inline that thing, and it might be better to export that one instead. >> Comments? > > I would agree with that. So I have a patch that does that, but it's noticeably bigger. It uninlines a fair amount of i387.h, and moves it into i387.c. I do think it's probably the right thing to do, though. I did a "make allmodconfig" with this on x86-64, but it's quite possible that x86-32 does additional cases. Does this patch work for people? (This is *on*top*of* the quick "let's just get it to work" patch that just exports the new percpu variable. I already committed that and pushed it out, since I wanted a quick fix so that people wouldn't be held up by this) IOW, if you can try this on top of current -git, that would be lovely. Linus --f46d043c094e92862f04b972ad2f Content-Type: text/x-patch; charset=US-ASCII; name="uninline-i387.diff" Content-Disposition: attachment; filename="uninline-i387.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_gywhsksl0 IGFyY2gveDg2L2luY2x1ZGUvYXNtL2kzODcuaCAgfCAgIDc4ICsrLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0KIGFyY2gveDg2L2tlcm5lbC9jcHUvY29tbW9uLmMgfCAgICAy IC0KIGFyY2gveDg2L2tlcm5lbC9pMzg3LmMgICAgICAgfCAgIDgwICsrKysrKysrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrKysrKwogMyBmaWxlcyBjaGFuZ2VkLCA4NCBpbnNlcnRpb25z KCspLCA3NiBkZWxldGlvbnMoLSkKCmRpZmYgLS1naXQgYS9hcmNoL3g4Ni9pbmNsdWRlL2FzbS9p Mzg3LmggYi9hcmNoL3g4Ni9pbmNsdWRlL2FzbS9pMzg3LmgKaW5kZXggMjQ3OTA0OTQ1ZDNmLi4w YzEwMzFkMzU0ZjIgMTAwNjQ0Ci0tLSBhL2FyY2gveDg2L2luY2x1ZGUvYXNtL2kzODcuaAorKysg Yi9hcmNoL3g4Ni9pbmNsdWRlL2FzbS9pMzg3LmgKQEAgLTQxOSw3MCArNDE5LDkgQEAgc3RhdGlj IGlubGluZSB2b2lkIF9fY2xlYXJfZnB1KHN0cnVjdCB0YXNrX3N0cnVjdCAqdHNrKQogCX0KIH0K IAotLyoKLSAqIFdlcmUgd2UgaW4gYW4gaW50ZXJydXB0IHRoYXQgaW50ZXJydXB0ZWQga2VybmVs IG1vZGU/Ci0gKgotICogV2UgY2FuIGRvIGEga2VybmVsX2ZwdV9iZWdpbi9lbmQoKSBwYWlyICpP TkxZKiBpZiB0aGF0Ci0gKiBwYWlyIGRvZXMgbm90aGluZyBhdCBhbGw6IHRoZSB0aHJlYWQgbXV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1Y3QgKnRzaykKK3sKKwlwcmVlbXB0X2Rp c2FibGUoKTsKKwlpZiAoX190aHJlYWRfaGFzX2ZwdSh0c2spKSB7CisJCV9fc2F2ZV9pbml0X2Zw dSh0c2spOworCQlfX3RocmVhZF9mcHVfZW5kKHRzayk7CisJfSBlbHNlCisJCXRzay0+ZnB1X2Nv dW50ZXIgPSAwOworCXByZWVtcHRfZW5hYmxlKCk7Cit9CitFWFBPUlRfU1lNQk9MKHVubGF6eV9m cHUpOworCiAjaWZkZWYgQ09ORklHX01BVEhfRU1VTEFUSU9OCiAjIGRlZmluZSBIQVZFX0hXRlAJ CShib290X2NwdV9kYXRhLmhhcmRfbWF0aCkKICNlbHNlCg== --f46d043c094e92862f04b972ad2f-- -- 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/