Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp305307lqt; Mon, 18 Mar 2024 08:20:13 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWb5M/s4MnwhPGsQUENdloe/QwgJ3kDIkRACjJWzx0fjErQuZwW2HgmjagGYdGUGRa4WQPUyYs/PTe4Ame3iuNjzqjzBYAe88iJYJnwfA== X-Google-Smtp-Source: AGHT+IHhzI2ajaJRhPvjmK0L/0Wn6oX9eclyYmNcHRBgY4tywaO0oyHqnQWDJYGmRU5OxqarGf5P X-Received: by 2002:a50:d7d7:0:b0:568:a226:6685 with SMTP id m23-20020a50d7d7000000b00568a2266685mr10701085edj.8.1710775212812; Mon, 18 Mar 2024 08:20:12 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710775212; cv=pass; d=google.com; s=arc-20160816; b=NVIpsFFdJBYIYBofVk4HSBcq2nC3sBWo7tM8x0fF2buoBtgLVwpo6bmycozjsJlTxh SOKcg3PTQ3gLA5MQWnMd69PTju7nsRfpasX/EDzt8Ruqb4p9aL2Rp7+LpraawwHseDPM SIJfk4Q3J/axuADTmNMkbksTVSlMOeuSVs/tWNDLLpDwT0W75mI1eKc+dQhrCuSRQ38Z BtgUHcSHaClIKgWfJJtBJCRBfANzwo/WOuVh3m3Prc3Mel38/ZTlF/0mhKx2OjE5IQ9o jQEp9KbDdAgZ7rrnFMWnLeiQDk3ABbY0JzWLmUY/pzrfiQZiP3eaZuYpOa5hbOdCODXr MCoA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=rayCM2prt2//9KKvtSxS+IFFDRjg7qyBPxuMRQQtlQg=; fh=/ahQHSKhGQMjrT+BRamK2m4hMmFyrMPWzrFVG89Hxig=; b=lTjcSzaQSYSNt7YS1YeBAZFwKhmSOqRvUbfN1HUajWMQjsw6ZZhixsyFXWWKMUXXgD ra0I33h+W75lKUn5hmek4SyTs68yDoyeCBrFT4igrQKpQ7fs0SizoPvQKKdtXg/7dmLx Mpe/bzUyag829cJfTJSAqmOlid3VqVK9aRX+57DD2ha7lNg+yMIRxHkmkEgHHaJxzxxv fmYu7ctDajASbt8WnHNoHydtAlmukY4Te3yUeMuWEOI1DVlr+y3kroJl4fMuRC+DB7pr c8CRkExCUoIiVfoEe+MKMq7GUH35HsEXHlRZiMyr9heWaiJ6xaZTjLDKbmBLwSgzQaVN XKUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GCTFw8mP; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-106287-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106287-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c12-20020a0564021f8c00b005676b7a8762si4529935edc.446.2024.03.18.08.20.12 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 08:20:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106287-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=GCTFw8mP; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-106287-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106287-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 85D561F217C9 for ; Mon, 18 Mar 2024 15:20:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D45FD4F1FC; Mon, 18 Mar 2024 15:20:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="GCTFw8mP" Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 50D354EB55 for ; Mon, 18 Mar 2024 15:19:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710775200; cv=none; b=nToSGs2aALITllRt+b+IXyyJuTD7A6nOmyptyWJStKjYPfumXMIhKRskc2eJ7XOIuoj3ZZj873SUDnE1jpwYoUWxwhAvYxkBMqUhokItaZ9vfkPdfIuIJ76/ypBe1pzSSPDFLaBluxdhUIXNPt5SrVsViI0I+RhnfMqAGIIlk90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710775200; c=relaxed/simple; bh=2Cg99J9ypIQesVjvEc6hc5B4sZc8qtrJtdq4K6UXCFw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=CZ3cznDXOK/gksPGCShBI7KEyWXOEOcPt0rKlApkwuDYfdCN8SkhhUKWmo1m5pgEBdYnlT3zTcSqUYxh7HIIZwYeMf+xmcP7t4C83iLWh0f3MXXvxHf9eqUHAUzNZLXQ9hShAoj9tihft15TNA0ihVPqNmYF9NnvX9K+2g/rH+Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=GCTFw8mP; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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; bh=rayCM2prt2//9KKvtSxS+IFFDRjg7qyBPxuMRQQtlQg=; b=GCTFw8mPDwozA5wqrfuTAhT5Oz Ruhi2mLN6L8F4/1OiORKj4bu5CoFp8GQ6y/4nvZK2VeGi5aBS1FfGMcVan4ia5IxP0xsiz31nabSv PHtpbVNvKBK3DR29b+8dhwxA/8J9hGSchtqopAfa7Pzz0FRollz3Br0VPHqudDXvyHPelWr203Kxb lxabtQS26yYMqUsANvtP/91eTCxMLDLTp4W6+UANLwoxX0IAQpQ9i4f0YDFWVGYoncx72SoJzrs/E qm+tFyxkWkZDNsZSvO+AgRJUjrm6RQo+0qBR3NGguVAh2V0SG4d2DljCNf/KoGYWMmj2m/T6gyMiY t0uS0nbw==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rmEmE-0000000HPue-3X4m; Mon, 18 Mar 2024 15:19:50 +0000 Date: Mon, 18 Mar 2024 15:19:50 +0000 From: Matthew Wilcox To: Pasha Tatashin Cc: David Laight , "H. Peter Anvin" , Kent Overstreet , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "akpm@linux-foundation.org" , "x86@kernel.org" , "bp@alien8.de" , "brauner@kernel.org" , "bristot@redhat.com" , "bsegall@google.com" , "dave.hansen@linux.intel.com" , "dianders@chromium.org" , "dietmar.eggemann@arm.com" , "eric.devolder@oracle.com" , "hca@linux.ibm.com" , "hch@infradead.org" , "jacob.jun.pan@linux.intel.com" , "jgg@ziepe.ca" , "jpoimboe@kernel.org" , "jroedel@suse.de" , "juri.lelli@redhat.com" , "kinseyho@google.com" , "kirill.shutemov@linux.intel.com" , "lstoakes@gmail.com" , "luto@kernel.org" , "mgorman@suse.de" , "mic@digikod.net" , "michael.christie@oracle.com" , "mingo@redhat.com" , "mjguzik@gmail.com" , "mst@redhat.com" , "npiggin@gmail.com" , "peterz@infradead.org" , "pmladek@suse.com" , "rick.p.edgecombe@intel.com" , "rostedt@goodmis.org" , "surenb@google.com" , "tglx@linutronix.de" , "urezki@gmail.com" , "vincent.guittot@linaro.org" , "vschneid@redhat.com" Subject: Re: [RFC 00/14] Dynamic Kernel Stacks Message-ID: References: <20240311164638.2015063-1-pasha.tatashin@soleen.com> <2cb8f02d-f21e-45d2-afe2-d1c6225240f3@zytor.com> <2qp4uegb4kqkryihqyo6v3fzoc2nysuhltc535kxnh6ozpo5ni@isilzw7nth42> <39F17EC4-7844-4111-BF7D-FFC97B05D9FA@zytor.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Mar 18, 2024 at 11:09:47AM -0400, Pasha Tatashin wrote: > The TLB load is going to be exactly the same as today, we already use > small pages for VMA mapped stacks. We won't need to have extra > flushing either, the mappings are in the kernel space, and once pages > are removed from the page table, no one is going to access that VA > space until that thread enters the kernel again. We will need to > invalidate the VA range only when the pages are mapped, and only on > the local cpu. No; we can pass pointers to our kernel stack to other threads. The obvious one is a mutex; we put a mutex_waiter on our own stack and add its list_head to the mutex's waiter list. I'm sure you can think of many other places we do this (eg wait queues, poll(), select(), etc).