Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3411191yba; Tue, 16 Apr 2019 10:46:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqzStRxq0YkfIWUPG291FczWOvQdfAtpkzdiN9sABB1/tfz3Kn6EVhY3wI28YUi2iPM/WgF3 X-Received: by 2002:a63:e304:: with SMTP id f4mr73384653pgh.374.1555436787854; Tue, 16 Apr 2019 10:46:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555436787; cv=none; d=google.com; s=arc-20160816; b=Jr5tBqs5R6oIO2ojbhIWXTYy/NMERZD2aiYNo69tTrt7ykTTFdYL0kcswmCxDoH+ZH h3kKsijqD+QVKwmB61VABJQCuo3bSg/uACu4P3nFzqeM4T71i4HZCwuJeFbSP2oO9M8o e99LbVAy/njznfl2of0RIz8FUCS2LDq7IM5WAlL54Crx2d4pOuZGJN6A8c3Gchh+zcBQ 827ydnDoP20hrcG50LCt3haOAx+4jXpbnZhmpaHkUhKWfhjMJrbsnNpOCUid3BxImmc3 mXzIrH7xrG7NOQkxmk/M3zbxkl3r5KnMyORvsACnPekzYayK3eV2ZxRWpEe2wlbyknwq gwOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=jbpWKY6ZmrFjccvhc7yiQ3HEAkuYcCFw7H49vIbWGjs=; b=dKxn3YkCsBRpAjYH4abq8M8/LyXvQEaHp7Hv22KSgWLslfvmhsujYKBYNv7wSf5eWN CYq8DWlZHqp+gXSdQnZqYqdzcxEOxT6n/0PRNC1O2Ky3NQDcyFjY8m8olQZGMQZD7cKp vPg553iHXP47OvjiCo3nB1oiCvM8GL3HRJtxjmucWQ5+q3X8zYP9xX1AZJaLcxUrxRtP b54ysu8+p/n6I24i4ztw3irwXXznWpu5H6bkuPz2Xqwijwd36/aHEptm3ByBnAuifO34 85ksSYws8h/fWcFguHwaKclf0HARyH4Sd1uiqEsQz9LoNF4Gpb1iuN/3Ra8KhUiSGg0R 1o8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=RiDL4i+r; 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 f8si36460259pgu.482.2019.04.16.10.46.03; Tue, 16 Apr 2019 10:46:27 -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=pass header.i=@linux-foundation.org header.s=google header.b=RiDL4i+r; 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 S1729653AbfDPRp0 (ORCPT + 99 others); Tue, 16 Apr 2019 13:45:26 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:44887 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727067AbfDPRp0 (ORCPT ); Tue, 16 Apr 2019 13:45:26 -0400 Received: by mail-lf1-f66.google.com with SMTP id h18so16662164lfj.11 for ; Tue, 16 Apr 2019 10:45:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=jbpWKY6ZmrFjccvhc7yiQ3HEAkuYcCFw7H49vIbWGjs=; b=RiDL4i+raBb8yY/GfV78XTsPIIlrSYywM2lvZDtopV5EinY1JSnpHRs83ytbv8ATYe 0E41jmh8xrwbeM5uRQuhllKrjPNYWTE5NtTVXA+V+SYTYHmcT3NWpvFEHHmLy0bH+HoC saX3cMfFGovtVndn9F/SJ4YM5dw+784WRdG2A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=jbpWKY6ZmrFjccvhc7yiQ3HEAkuYcCFw7H49vIbWGjs=; b=lBU4sQo9eAyIp2n+DSnkbWN9m/OIAcVDxvKMo7r0CMUESI434WcuIcrax3+EWsgyfY 9AV93Y3vJ1z+ol9nBPUNT+Yrz1Xi4ozyyLpDT2+d0p8soY2jltXmUIeGlhKk6wZeBaxI gaHWcnNemT2FxMQP06LF036iOCXqzVz1WHUb7gYc7mXtGJnBeJgACezaz78xb6FeXQHD xFMhT+8Sz33jQ+wIWIiLWR8YCcupG2/X9ONnprsqIyxvrCDuKV5JPsC8FYXS339D4w8p VPW5TM3bU/PefdMRIN4/CRUHm2IXFixk8I67NfJAlLZMO+e4XKxl7NNh8X5lqoRhqt3W H7Kw== X-Gm-Message-State: APjAAAVz1u7FGpIOmdX8q7uG1yvKXzqhwQtTOU+xQAsxo9DVpoYhVZ/c tQkpbkc21GZOmes3drARzwpGXsz445Q= X-Received: by 2002:ac2:5381:: with SMTP id g1mr45064025lfh.130.1555436723355; Tue, 16 Apr 2019 10:45:23 -0700 (PDT) Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com. [209.85.167.53]) by smtp.gmail.com with ESMTPSA id g24sm10799383lfb.49.2019.04.16.10.45.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Apr 2019 10:45:22 -0700 (PDT) Received: by mail-lf1-f53.google.com with SMTP id h18so16662070lfj.11 for ; Tue, 16 Apr 2019 10:45:21 -0700 (PDT) X-Received: by 2002:ac2:5505:: with SMTP id j5mr8685489lfk.121.1555436721366; Tue, 16 Apr 2019 10:45:21 -0700 (PDT) MIME-Version: 1.0 References: <20190416080335.GM7905@worktop.programming.kicks-ass.net> In-Reply-To: <20190416080335.GM7905@worktop.programming.kicks-ass.net> From: Linus Torvalds Date: Tue, 16 Apr 2019 10:45:05 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] x86/tlb: Revert: Align TLB invalidation info To: Peter Zijlstra Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Linux List Kernel Mailing , Andy Lutomirski , Nadav Amit , Dave Hansen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 16, 2019 at 1:03 AM Peter Zijlstra wrote: > > Using 320 bytes of stack space for a 40 byte structure is ludicrous and > clearly not right. Ack. That said, I wish we didn't have these stack structures at all. Or at least were more careful about them. For example, another case of this struct on the stack looks really iffy too: struct flush_tlb_info info; info.start = start; info.end = end; on_each_cpu(do_kernel_range_flush, &info, 1); note how it only initializes two of the fields, and leaves the others entirely randomly initialized with garbage? Yeah, yeah, "do_kernel_range_flush()" only uses those two fields, but it still makes my skin crawl how we basically pass a largely uninitialized structure and have other CPU's look at it. And in another case we do have a nicely initialized structure void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch) { struct flush_tlb_info info = { .mm = NULL, .start = 0UL, .end = TLB_FLUSH_ALL, }; but it looks like it shouldn't have been on the stack in the first place, because as far as I can tell it's entirely constant, and it should just be a "static const" structure initialized at compile time. So as far as I can tell, we could do something like -static void flush_tlb_func_local(void *info, enum tlb_flush_reason reason) +static void flush_tlb_func_local(const void *info, enum tlb_flush_reason reason) - struct flush_tlb_info info = { + static const struct flush_tlb_info info = { for that case. End result: it looks like we have three of these stack things, and all three had something odd in them. So very much Ack on that patch, but maybe we could do a bit more cleanup here? Linus