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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69643C433EF for ; Thu, 30 Sep 2021 08:16:17 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 005FB615E2 for ; Thu, 30 Sep 2021 08:16:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 005FB615E2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 88E09940094; Thu, 30 Sep 2021 04:16:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 83F0D94003A; Thu, 30 Sep 2021 04:16:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 753D8940094; Thu, 30 Sep 2021 04:16:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0196.hostedemail.com [216.40.44.196]) by kanga.kvack.org (Postfix) with ESMTP id 66C1994003A for ; Thu, 30 Sep 2021 04:16:16 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 003048249980 for ; Thu, 30 Sep 2021 08:16:15 +0000 (UTC) X-FDA: 78643532352.32.12978C9 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf11.hostedemail.com (Postfix) with ESMTP id B3773F000233 for ; Thu, 30 Sep 2021 08:16:15 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 53F5661528; Thu, 30 Sep 2021 08:16:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632989774; bh=IG9QanQU30BLOgTHId32QxYcNknUkvBQ+NHpixLYVRQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=r/QiGQjMBdERAF+TEj/DaIlMsGCQTgzbvy1yvZpmUKkympQ2p3y9BFGXwHdhcT0tf i7M9CfaKuPQQ5RVAK+/tRVKSp+oR2mnUmmbNx/9KKdjcXdnaInSfMPDV2i+zpUYkHk 2YSCDJ1tF0tzOArcbGJQHC1iZgYfrohiAwO+vZmj7wDpKb006LxLNKtLlAtGMGL91u lRfl8gglbql1M4KFSkiqcf3NYXU6gnPHnhTfkSwySAZM1bMXmbmWK9gGiZcVkvDxyd EJgh9cWq1xivkblynxfp20eC3NbHEWZpbX9sVRWfuolWWE0ksGR0zWDHE8NEq4Z04e MkFb6pq9C3ErQ== Date: Thu, 30 Sep 2021 09:16:07 +0100 From: Will Deacon To: Pasha Tatashin Cc: James Morris , Sasha Levin , "Eric W. Biederman" , kexec mailing list , LKML , Jonathan Corbet , Catalin Marinas , Linux ARM , Marc Zyngier , James Morse , Vladimir Murzin , Matthias Brugger , linux-mm , Mark Rutland , steve.capper@arm.com, rfontana@redhat.com, Thomas Gleixner , Selin Dag , Tyler Hicks , Pingfan Liu , Andrew Morton , madvenka@linux.microsoft.com Subject: Re: [PATCH v17 08/15] arm64: kexec: configure EL2 vectors for kexec Message-ID: <20210930081607.GA23250@willie-the-truck> References: <20210916231325.125533-1-pasha.tatashin@soleen.com> <20210916231325.125533-9-pasha.tatashin@soleen.com> <20210929123513.GC21631@willie-the-truck> 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) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="r/QiGQjM"; spf=pass (imf11.hostedemail.com: domain of will@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=will@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: B3773F000233 X-Stat-Signature: inf33ns5ag3hi4otmnxtb88xebjir1qz X-HE-Tag: 1632989775-860510 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed, Sep 29, 2021 at 11:54:55PM -0400, Pasha Tatashin wrote: > > > +/* Allocates pages for kexec page table */ > > > +static void *kexec_page_alloc(void *arg) > > > +{ > > > + struct kimage *kimage = (struct kimage *)arg; > > > + struct page *page = kimage_alloc_control_pages(kimage, 0); > > > + > > > + if (!page) > > > + return NULL; > > > + > > > + memset(page_address(page), 0, PAGE_SIZE); > > > > Hmm, I think we might be missing barriers here to ensure that the zeroes > > are visible to the page-table walker before we plumb the page into the > > page-table. > > > > Usually, that's taken care of by the smp_wmb() in __pXX_alloc() but I > > can't see that here. Is it hiding? > > Based on the comment in __pte_alloc() that smp_wmb() is needed in > order to synchronize pte setup with other cpus prior to making it > visible to them. This is not needed here. First, by the time these > page tables are used the other cpus are offlined (kexec reboot code is > single threaded). Second, we never insert any entry into a page table > that is actively used by any cpu. I think the comment there is wrong, but the barrier is still necessary. How else do you guarantee that the page-table walker reads the zeroes from the memset? Will