Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7775888ybi; Thu, 6 Jun 2019 01:05:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9laStbOAVzdZ0BV2UeIIOvfW3eq1+KeIcY30Hh5tJwrYREqQjOdULK/EBXOKgroxzbHL9 X-Received: by 2002:a17:902:8210:: with SMTP id x16mr48606726pln.306.1559808349178; Thu, 06 Jun 2019 01:05:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559808349; cv=none; d=google.com; s=arc-20160816; b=dTMiy6769MnEQ1j2gFBOsQncQeLKqCpeYtMwiLHwgkiDyZ/ift42vuXSrb0vRerX53 WoVFQnC7eBC/dPQviGoMWM5Y1GXVWEUmXLsaqm0RXFZ11oc5pYKP4YVS4G7oq2o0Zx0D S7coXcO6608su8PfzYJXi1H3i0GpZbMcdmcb/nI1q/nsh85jbDZ/BjR6C46Raj6Z10es S/XU6BQbtJa9dl/BWZAHhH2eBOabaugXO30ZVdy9+hDrTbhudE1cpFnUboojPm+pJC5t w4I35vGfiozdE5xFbN8Cz84OND1Og/hN62hP8drUmMFFd9Xo8WVyQliG60X9TlMWOaG1 qe3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=QSKGyxx9Q9AJKtpqgKbGwuoacV8z0/sDEo2YsWMHixs=; b=DhUy56lcgJRIyMTIWL+FrRkIIxQXF2E1jdKhq4QzNMk9wkaITSPb+GINnoyXX7DWDu P8wRfZmNqUyvoHE/Daj/5rK15OJ9c1Bo6ywb5nGKd8DeLcb/aCuVTEORT+EBVaLyEsk5 tjw+TNYhH0Qjl5LqRiQLkJxDhInog5U7vVvbCfjKntWaCNr6ROjLXBibtNwYpLZL7oPN 2hmTWuOlPsOq17Y5cAXa+7u0gXaOxWepLebCioTpOK7JTvW9yZfe0y0UwA6AwZf52smB ySNVSsoYVhobAcCLqCjUsrVtq1vfq18JkfpmubnxyWjtO1SPCHK5ppcjGwsuYSl4vTsT 0MoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=m0s9DUtY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i5si1205192pfr.52.2019.06.06.01.05.31; Thu, 06 Jun 2019 01:05:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=m0s9DUtY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726947AbfFFIDg (ORCPT + 99 others); Thu, 6 Jun 2019 04:03:36 -0400 Received: from merlin.infradead.org ([205.233.59.134]:60762 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbfFFIDf (ORCPT ); Thu, 6 Jun 2019 04:03:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QSKGyxx9Q9AJKtpqgKbGwuoacV8z0/sDEo2YsWMHixs=; b=m0s9DUtYOds2uc7WJfqzS3t14 e1a5PkDuo5Rqai36yA9Mgw6v6lF3VcsB2M1Dv1lByAzNdVYKCEsWX1lnMSU5eLt6yiYW3hpUZFJgO bGS7gSojJwwHho6LqPC11dMXzwEIXW7rd+W6oMJYc6HRqY0tSOSgs7UXnvR/AwOBMCgvT+7jHBoeR w8jgEeCZ2z5aBB36HYzOVX9XfAzNK/7FNR2BWYi75RH/qQlbJd9XEl5rd2it+yiqx8zojxZMdHv+9 6VIwFddYcsWycurAijzWZsa0Q1cyjYR2KETj/0RFrHuIywSo2o0RiwpPxgb3fbPD4Dsf48t2o48S5 BVjmpnp0w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hYnMj-0006gX-Gc; Thu, 06 Jun 2019 08:03:17 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 35B18203AA6FD; Thu, 6 Jun 2019 10:03:15 +0200 (CEST) Date: Thu, 6 Jun 2019 10:03:15 +0200 From: Peter Zijlstra To: Linus Torvalds Cc: Waiman Long , Ingo Molnar , Will Deacon , Thomas Gleixner , Borislav Petkov , "H. Peter Anvin" , Linux List Kernel Mailing , the arch/x86 maintainers , Davidlohr Bueso , Tim Chen , huang ying , dvyukov@google.com, glider@google.com, aryabinin@virtuozzo.com Subject: Re: [PATCH v8 15/19] locking/rwsem: Adaptive disabling of reader optimistic spinning Message-ID: <20190606080315.GE3402@hirez.programming.kicks-ass.net> References: <20190520205918.22251-16-longman@redhat.com> <20190604092008.GJ3402@hirez.programming.kicks-ass.net> <8e7d19ea-f2e6-f441-6ab9-cbff6d96589c@redhat.com> <20190604173853.GG3419@hirez.programming.kicks-ass.net> <20190604181426.GH3419@hirez.programming.kicks-ass.net> <46e44f43-87fd-251b-3b83-89a8bb3b407f@redhat.com> <20190605201901.GB3402@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 05, 2019 at 01:52:15PM -0700, Linus Torvalds wrote: > On Wed, Jun 5, 2019 at 1:19 PM Peter Zijlstra wrote: > > > > Urgh, that's another things that's been on the TODO list for a long long > > time, write code to verify the alignment of allocations :/ I'm > > suspecting quite a lot of that goes wrong all over the place. > > On x86, we only guarantee 8-byte alignment from things like kmalloc(), iirc. Oh sure, and I'm not proposing to change that. I was more thinking of having a GCC plugin that verifies, for every ptr assignment: ptr = foo; that the actual alignment maches: assert(!(uintptr_t)ptr % __alignof(*ptr)); That would catch bugs like: struct bar { int ponies; int peaches __smp_cacheline_aligned; }; struct bar *barp = kmalloc(sizeof(barp, GFP_KERNEL); Blatantly violating alignment can't be right; either the alignment constraints put on the data structures are not important and they should be fixed, or we should respect them and fix the allocation, either way, we should not silently violate things like we do today.