Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp727349rdb; Fri, 22 Dec 2023 03:20:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtukmlVWsVD3PuzV99b/ig15FqGYE7rA0r1OX2+WY1a6rgxZJnU5QfeUhc2RghNPqYoXVF X-Received: by 2002:a05:6359:6e0b:b0:170:4035:4f94 with SMTP id th11-20020a0563596e0b00b0017040354f94mr700090rwb.25.1703244002868; Fri, 22 Dec 2023 03:20:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703244002; cv=none; d=google.com; s=arc-20160816; b=QA1gjRkGTSKD/SbiycAgq/1hlHGUkAYQ0nbAU9kmuROew8NbVGaqI94a1SldR9M30q srpY4shkcvYCeAykN05WTAR/vF2eVneCeXCIiX7RnxbkfAz+H86NhevOiLQTDH1ecrc9 uQRDCIJKcTDE31wht4LtCyVXawiK+PSUZvIi7ir5S2SXEaP8pnm70kRFr5eyIZNGxtWy tU7GmDyuSid0poVEZBzqKxo6cQJbD12J5kFuAxHzb1LZQeeiTopU1ODYkaMoewDzG/Wz y1BMOiJRpo81cVRStzR6k4fcBa/pRHq9JuVL7UwHE/enm1Png2A78WBXhahEg+saUGyC XQiQ== ARC-Message-Signature: i=1; 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=9mbvhxrIKIoL5bu9K8i34Gsn4I2dlLM8GqMKrhpqo5k=; fh=f4SnCP18GcvdWICWlZ/o9/0mE+7famEFm5zezDEmU9w=; b=QBuZXemivmcEUmxxLY15Z1eXwpWtisbgV+qOk1O3eu/p2a4dC7NDl3xyFFB0C2AToB RZHiI8sJgI1ThEyJPfwH8V+GKF5d8+TAwhiRkOUyhNW7He6w3Q6GQ8UYPyys4G6h0GiD +Nq/Duo1fRREv7r36gsiH8AiY/cZDzYaARnCdlXiDA6RM2+TlX84bMis6hjP1F4P62AH Gg336BsvLnqc00nsqzc+tCFdeEMBWtqRhE1ubnmQ9pUmiqZasVVNT41Bl4FlYz0n1t/K zftZqcLS7DPeu9Z2JnDKfoq6iYfLWrogNldKXufgva6wSCeL+kHterCBLY9RRAo73eW9 TwPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CC7obWX5; spf=pass (google.com: domain of linux-kernel+bounces-9655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z16-20020a05622a029000b00423e65dc48dsi4161986qtw.703.2023.12.22.03.20.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Dec 2023 03:20:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-9655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CC7obWX5; spf=pass (google.com: domain of linux-kernel+bounces-9655-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-9655-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8DEEE1C203A3 for ; Fri, 22 Dec 2023 11:20:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 584F9171B6; Fri, 22 Dec 2023 11:19:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CC7obWX5" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) (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 389D517743 for ; Fri, 22 Dec 2023 11:19:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703243994; x=1734779994; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=3Tufpk+YO6oOHzRVAgnjreBrHj/vaGdbgRUn173Wy3g=; b=CC7obWX5cV6xhOX67vTxqJh/5sdqtZAVdxg/Szywo4CbpleccOWcLPfi lrtyIsCZ6zT5VlTHmsBJbTTeT3BFXkoY4OAR45dzxpN1sHrSFRG+GdXFr 3ZAjx0kQm86RckeDfhynZ5H595iiVHJGhkQVHV6gxJXQOst2zBn2tnz6N fYhP/PyS1ws6/vVuXCrGvoYC8IJ/rj1JAGW8x/BRe99jh0u7l55Z6zxPA qMGzvnyNDvOuN/Zv+vemubl3i9ixF5OSnU35+M8H34j3FxAlRQkAP/Kmb /q55dxGoOjU1YcQi8BzmRp2dedjzi9zbuAHmrFgQC8aSwaWtJReZ8HvDB g==; X-IronPort-AV: E=McAfee;i="6600,9927,10931"; a="482284938" X-IronPort-AV: E=Sophos;i="6.04,296,1695711600"; d="scan'208";a="482284938" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 03:19:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10931"; a="780524686" X-IronPort-AV: E=Sophos;i="6.04,296,1695711600"; d="scan'208";a="780524686" Received: from hassanfa-mobl.ger.corp.intel.com (HELO box.shutemov.name) ([10.252.33.171]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Dec 2023 03:19:48 -0800 Received: by box.shutemov.name (Postfix, from userid 1000) id 005ED10945B; Fri, 22 Dec 2023 14:19:45 +0300 (+03) Date: Fri, 22 Dec 2023 14:19:45 +0300 From: "kirill.shutemov@linux.intel.com" To: "Huang, Kai" Cc: "tglx@linutronix.de" , "mingo@redhat.com" , "x86@kernel.org" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "Edgecombe, Rick P" , "Reshetova, Elena" , "Nakajima, Jun" , "rafael@kernel.org" , "peterz@infradead.org" , "linux-kernel@vger.kernel.org" , "sathyanarayanan.kuppuswamy@linux.intel.com" , "Hunter, Adrian" , "thomas.lendacky@amd.com" , "ashish.kalra@amd.com" , "kexec@lists.infradead.org" , "seanjc@google.com" , "bhe@redhat.com" , "linux-coco@lists.linux.dev" Subject: Re: [PATCHv4 14/14] x86/acpi: Add support for CPU offlining for ACPI MADT wakeup method Message-ID: <20231222111945.mqzacijpqnzbgxbp@box> References: <20231205004510.27164-1-kirill.shutemov@linux.intel.com> <20231205004510.27164-15-kirill.shutemov@linux.intel.com> <3a080962fea97efbb8e102c1de34bc766d7a53b6.camel@intel.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: <3a080962fea97efbb8e102c1de34bc766d7a53b6.camel@intel.com> On Tue, Dec 05, 2023 at 11:36:55PM +0000, Huang, Kai wrote: > > > + > > +static void acpi_mp_stop_other_cpus(int wait) > > +{ > > + smp_shutdown_nonboot_cpus(smp_processor_id()); > > +} > > Is this and ... > > + smp_ops.stop_other_cpus = acpi_mp_stop_other_cpus; > > ... this below still needed? > > I think the current native_stop_other_cpus() should just work given you have set > up ... > > + smp_ops.crash_play_dead = crash_acpi_mp_play_dead; > > ... for TDX guest? To make it work stop_this_cpu() would need to be modified to use smp_ops.crash_play_dead() instead of native_halt(). But name of the callback doesn't match the function, so I renamed it to smp_ops.stop_this_cpu(). > Sorry for saying this late. I think we can also use kernel_ident_mapping_init() > to do the init_transition_pgtable()? We can set struct x86_mapping_info::offset > to __PAGE_OFFSET to do that? > > Looks set_up_temporary_mappings() in arch/x86/power/hibernate_64.c uses the same > trick. > > Anyway I am not sure how many LoC (assuming can do) can be saved so up to you. Yeah. Benefit is not clear to me. I will leave it as is. > > It's a little bit sad such cleanup code isn't in common code, e.g., with a > > void (*free_pgt_page)(void *); > > to allow the user to specify how to free the page table. > > But this can be future job if needed. I will consider moving this cleanup in common code. And maybe fix other users of kernel_ident_mapping_init(). Nobody seems to care to cleanup page tables on ENOMEM. -- Kiryl Shutsemau / Kirill A. Shutemov