From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47E0BC54E60 for ; Thu, 14 Mar 2024 18:26:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC65A800D9; Thu, 14 Mar 2024 14:26:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B76F0800B4; Thu, 14 Mar 2024 14:26:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1837800D9; Thu, 14 Mar 2024 14:26:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8D921800B4 for ; Thu, 14 Mar 2024 14:26:15 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 3A3BA120783 for ; Thu, 14 Mar 2024 18:26:15 +0000 (UTC) X-FDA: 81896474310.27.E7E23FB Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf17.hostedemail.com (Postfix) with ESMTP id 6420940012 for ; Thu, 14 Mar 2024 18:26:12 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=vGhQHSyC; dkim=pass header.d=linutronix.de header.s=2020e header.b=yuhs32qs; spf=pass (imf17.hostedemail.com: domain of tglx@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=tglx@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1710440772; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=OT14uNtw6W0ZjCQ33RZUVgtWubWcRnNaxohmLkNQdCc=; b=deG/3cHyvqXGvrWbHCAw2SxrRs01rb5sVGZiKBtcGkbb3kvOkNTF29aWjLBpUcSynMdozX 0wlkRGSYf02EAgxtQd0YH/OwRKyeJZm222AA4rHl0QHX7EP2f9k3EPKwN/Cd/hCT6Qx2Tc IJabCh7hc7wM4DiSTHjPHacvfTL2Xyo= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=vGhQHSyC; dkim=pass header.d=linutronix.de header.s=2020e header.b=yuhs32qs; spf=pass (imf17.hostedemail.com: domain of tglx@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=tglx@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1710440772; a=rsa-sha256; cv=none; b=8mj3kT/tjEnan+HJod8jXHERJWfU+ZtN0gjRIcFIw65Bd065AHipFg639Mg4c/xxGmJbvJ tGsJg+QuNKuqVpVmnHh40VXECqwKBI9hSC/n4iTKuUO8TmHuwHhIhgp7IZJzSrJzwkdWY1 lO/b3CpTV/z40C2bkRksKi3bkI+UY54= From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1710440769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OT14uNtw6W0ZjCQ33RZUVgtWubWcRnNaxohmLkNQdCc=; b=vGhQHSyCkQ0VUh5HYVjZVY8hylof6whCFJs79bZ5Lt0/fTGSh3dZ5z3y/GoxFxfehu8CSz bqRZgCKXGr0xSC9T4RmgKrT1ivs81KeAQ/ZVpbZWG6rV3bx62N/RtzgElCySvi62plzY0v JH0Q1trQw1LjwKaQv3gwl++w4PGKCFm3zXOH8FOkSWJ8cDx3JMkfjZUFW46hiLM7f/Jldk jqBq1Ugk5W1v5VpUB7Butgr1eWGtfIo9/kQo5T99WvhjvG1DNXWv/tudj9xFRf2qtUwHix r8ZtYQ9pmB4y12/mjXhaYV8CCNBPYcrD35j6DO5dkkg5Z7NfMM1CiJG+cbgS9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1710440769; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OT14uNtw6W0ZjCQ33RZUVgtWubWcRnNaxohmLkNQdCc=; b=yuhs32qsRTZnBHrQkpPUXoqiyigddgGgWFc3xDguGV11mBHpyuFVQtHxsHdAzZXLBoTCDl UPdtLeS1DC9pP0AQ== To: Pasha Tatashin Cc: 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, hpa@zytor.com, jacob.jun.pan@linux.intel.com, jgg@ziepe.ca, jpoimboe@kernel.org, jroedel@suse.de, juri.lelli@redhat.com, kent.overstreet@linux.dev, 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, urezki@gmail.com, vincent.guittot@linaro.org, vschneid@redhat.com Subject: Re: [RFC 11/14] x86: add support for Dynamic Kernel Stacks In-Reply-To: References: <20240311164638.2015063-1-pasha.tatashin@soleen.com> <20240311164638.2015063-12-pasha.tatashin@soleen.com> <87v85qo2fj.ffs@tglx> <87bk7inmah.ffs@tglx> Date: Thu, 14 Mar 2024 19:26:09 +0100 Message-ID: <871q8cmzzy.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 6420940012 X-Rspam-User: X-Stat-Signature: 4rior794a61jb7hpssmj6idfi89py9ue X-Rspamd-Server: rspam01 X-HE-Tag: 1710440772-96254 X-HE-Meta: U2FsdGVkX1+UBW5uzyBjaO6Hz2ajb2Tgzfj9GIxxHPbR7xbhVaY69YPP63Omp9Xeq0jqMrB1kV4gvoztrukSrnAYy5YBqXXXd1jGc7ybvHM0VE1FxpjSsjd1OFf4WT6NA7Tic2tAJFZWJoNL4biXA6I9T9ZUx4iApJ/xN+Nzw1EzNWtLWSU+W7hp85i13YnmZycgS9eXU9nd5T8qFLJCp2LK1nYIfg3Cg5oqqzQB6cJr2SKBToUUHeZVEpu7m4ilxKyCccopTHTll23946dNU9t7GEkcn7n18pxuQ8TK497A7Zx1WrDsLMA4IGEwDdsy/rKtOy7Xo9UcTIR/j17LEx8aHQymXZjtKI4WB4N9KoSeXe+Cst3Kxfs6VVDIDciAogf7eKOpaXVXi9bT0lpcsy2zepG1GUUmgCKs0uWHj1Rj1YTdpzQM8UEkZBbXNOHZfFFTBG16fXq9Ddv1W6Qvs05SNPLy9rRn/8tVRbL7lM8yHLf3SE9MmN4fUko2+PjlfWYPBYR/SGYPUpiiEzOqCUuplTa8GPsIJBx8ZQEoGrpviRsZYEJ8B2OrSnwGU7WecxqsidmA7/Dbduhw1BbDVGyhAdVnbQye7an407PF044ZjDU8K8EHf3kdeECn1M9vrBtkYCYniv5RaiS85gxXR9s369pk70JhG//PfOmguNfy7AZOtzVoMt/5Ui7SKtS8B5WVhFQxIAzTdO3XanAqilGgsRVYiudNrY5tvk5xL1JuGOIY4IOOXHOUFB+DGvd0uu7+gVgRZ9zIh/cBkfL2dFYTahD5ALrXF6qVrJqGeOOgXC/wox3zhu72kAPqAdf0loXYAv084ZlVdyd4VLu6aWKV0HsVvehsF73fxk0IWAX0TWrGTNgIDnjpzljNvSQanXNPY0W/qi7659XsvjP3Tjm10ctmbkt5Zi6B6co+SM1QK+ojbXtcOHOOvCQ7WbF2nPa8q3X1yH0f0kRa6il mC0dhV/B p6YAEsEDoe4HQsYmT3wArXXTuv+OPtejUQzivZXfgqTwaEtGezlWuUN/jkVaXNMAGXQgdJSQOP/o//Up1SCMb3EsyQcMXe+j6z3+0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000608, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Mar 14 2024 at 10:03, Pasha Tatashin wrote: > On Wed, Mar 13, 2024 at 12:12=E2=80=AFPM Thomas Gleixner wrote: >> That needs to validate whether anything uses current between the stack >> switch and the place where current is updated today. I think nothing >> should do so, but I would not be surprised either if it would be the >> case. Such code would already today just work by chance I think, >> >> That should not be hard to analyze and fixup if necessary. >> >> So that's fixable, but I'm not really convinced that all of this is safe >> and correct under all circumstances. That needs a lot more analysis than >> just the trivial one I did for switch_to(). > > Agreed, if the current task pointer can be switched later, after loads > and stores to the stack, that would be a better solution. I will > incorporate this approach into my next version. No. You need to ensure that there is neither a load or store on the stack between: movq %rsp, TASK_threadsp(%rdi) movq TASK_threadsp(%rsi), %rsp and update_current(). IOW, you need to move the update of pcpu_hot.current to ASM right after the RSP switch. > I also concur that this proposal necessitates more rigorous analysis. Glad we agree here :) Thanks, tglx