Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936063Ab3DIOcp (ORCPT ); Tue, 9 Apr 2013 10:32:45 -0400 Received: from mail-ve0-f170.google.com ([209.85.128.170]:51696 "EHLO mail-ve0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756026Ab3DIOco (ORCPT ); Tue, 9 Apr 2013 10:32:44 -0400 MIME-Version: 1.0 In-Reply-To: References: <1364998282-21437-1-git-send-email-vgupta@synopsys.com> <20130404152808.GB15261@ab42.lan> <515E54BD.2090300@synopsys.com> <51602459.3040105@synopsys.com> <51624591.4010303@synopsys.com> <1365428274.2609.160.camel@laptop> <1365431470.2733.16.camel@fedora> <1365433142.2733.18.camel@fedora> Date: Tue, 9 Apr 2013 07:32:42 -0700 X-Google-Sender-Auth: Qor1Ys8A5ifZH5F5BYdnKAMk_oY Message-ID: Subject: Re: [PATCH] [PATCH] Gaurantee spinlocks implicit barrier for !PREEMPT_COUNT From: Linus Torvalds To: Steven Rostedt Cc: Peter Zijlstra , Vineet Gupta , Thomas Gleixner , Christian Ruppert , Pierrick Hascoet , Frederic Weisbecker , Ingo Molnar , Linux Kernel Mailing List Content-Type: multipart/mixed; boundary=089e0158b26821f7a204d9ee6d58 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7411 Lines: 121 --089e0158b26821f7a204d9ee6d58 Content-Type: text/plain; charset=UTF-8 On Mon, Apr 8, 2013 at 8:07 AM, Linus Torvalds wrote: > On Mon, Apr 8, 2013 at 7:59 AM, Steven Rostedt wrote: >>> +/* This is only a barrier to other asms. Notably get_user/put_user */ >> >> Probably should add in the comment: >> >> " or anything else that can cause a hidden schedule. " >> > > Fair enough. And I just remembered why I thought UP was special - we > need to do the same thing about spinlocks, for the same reasons. > > So that "asm_barrier()" should probably be in along > with the "normal" barrier() definition. > I'm a moron. Yes, "asm_barrier()" is a valid barrier for asms. But without the "memory" clobber, it doesn't actually end up being a barrier to any normal C loads and stores from memory, so it doesn't actually help. So I suspect we need to just make UP spinlocks and preemption enable/disable be full compiler barriers after all. Something like the attached (still untested, although it seems to at least compile) patch. Comments? Linus --089e0158b26821f7a204d9ee6d58 Content-Type: application/octet-stream; name="patch.diff" Content-Disposition: attachment; filename="patch.diff" Content-Transfer-Encoding: base64 X-Attachment-Id: f_hfb64qjy0 IGluY2x1ZGUvbGludXgvcHJlZW1wdC5oICAgICB8IDIyICsrKysrKysrKysrKysrLS0tLS0tLS0K IGluY2x1ZGUvbGludXgvc3BpbmxvY2tfdXAuaCB8IDI5ICsrKysrKysrKysrKysrKysrKy0tLS0t LS0tLS0tCiAyIGZpbGVzIGNoYW5nZWQsIDMyIGluc2VydGlvbnMoKyksIDE5IGRlbGV0aW9ucygt KQoKZGlmZiAtLWdpdCBhL2luY2x1ZGUvbGludXgvcHJlZW1wdC5oIGIvaW5jbHVkZS9saW51eC9w cmVlbXB0LmgKaW5kZXggNWE3MTBiOWM1NzhlLi44N2EwM2M3NDZmMTcgMTAwNjQ0Ci0tLSBhL2lu Y2x1ZGUvbGludXgvcHJlZW1wdC5oCisrKyBiL2luY2x1ZGUvbGludXgvcHJlZW1wdC5oCkBAIC05 MywxNCArOTMsMjAgQEAgZG8geyBcCiAKICNlbHNlIC8qICFDT05GSUdfUFJFRU1QVF9DT1VOVCAq LwogCi0jZGVmaW5lIHByZWVtcHRfZGlzYWJsZSgpCQlkbyB7IH0gd2hpbGUgKDApCi0jZGVmaW5l IHNjaGVkX3ByZWVtcHRfZW5hYmxlX25vX3Jlc2NoZWQoKQlkbyB7IH0gd2hpbGUgKDApCi0jZGVm aW5lIHByZWVtcHRfZW5hYmxlX25vX3Jlc2NoZWQoKQlkbyB7IH0gd2hpbGUgKDApCi0jZGVmaW5l IHByZWVtcHRfZW5hYmxlKCkJCWRvIHsgfSB3aGlsZSAoMCkKLQotI2RlZmluZSBwcmVlbXB0X2Rp c2FibGVfbm90cmFjZSgpCQlkbyB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9jayk7 IDE7IH0pCisjIGRlZmluZSBhcmNoX3NwaW5fbG9jayhsb2NrKQkJZG8geyBiYXJyaWVyKCk7ICh2 b2lkKShsb2NrKTsgfSB3aGlsZSAoMCkKKyMgZGVmaW5lIGFyY2hfc3Bpbl9sb2NrX2ZsYWdzKGxv Y2ssIGZsYWdzKQlkbyB7IGJhcnJpZXIoKTsgKHZvaWQpKGxvY2spOyB9IHdoaWxlICgwKQorIyBk ZWZpbmUgYXJjaF9zcGluX3VubG9jayhsb2NrKQlkbyB7IGJhcnJpZXIoKTsgKHZvaWQpKGxvY2sp OyB9IHdoaWxlICgwKQorIyBkZWZpbmUgYXJjaF9zcGluX3RyeWxvY2sobG9jaykJKHsgYmFycmll cigpOyAodm9pZCkobG9jayk7IDE7IH0pCiAjZW5kaWYgLyogREVCVUdfU1BJTkxPQ0sgKi8KIAog I2RlZmluZSBhcmNoX3NwaW5faXNfY29udGVuZGVkKGxvY2spCSgoKHZvaWQpKGxvY2spLCAwKSkK --089e0158b26821f7a204d9ee6d58-- -- 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/