Received: by 2002:ab2:7041:0:b0:1f4:bcc8:f211 with SMTP id x1csp47082lql; Fri, 12 Apr 2024 03:21:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWqruk03q+bo/1VOBgmJj7FyMytynM3+ZXNYFBd29ByA+GiCFbCJ5JzwYWTf5QBrDrdW1mK66sr7pAeSC+fNJcpKjrFqxTOJDJYaQomgQ== X-Google-Smtp-Source: AGHT+IEI2pEvB+M+UlQjwNkd8f8UZAIKuqQO5yIMvPhXb/IxFwiF/Ea6bHYnNOViQBrYUnh0ps4O X-Received: by 2002:a05:6870:1656:b0:22e:8406:5bc4 with SMTP id c22-20020a056870165600b0022e84065bc4mr2267336oae.32.1712917279578; Fri, 12 Apr 2024 03:21:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712917279; cv=pass; d=google.com; s=arc-20160816; b=eyy238MukRTpV+SRMnjnP2+ZVICwSNAjtAR1vVvOT898Tw6dUQHGay7tMNB3nxnfaf z7ZvDRXqGG9SOugcY6UoLLujAd6DK2ejVDXtgC56mdp2pxfsOKRK8botF7mxmzKtb6dj TEkjzzlg1mYNBnPseaEjKXgI25FI8PctzXO8Lgf/lo+2tnFX5GRnaJYLWMCOhHb0vYoB cJPD9mlat/yz3O4xQbeDlR3QfZ31I+ANHvRmQArfz4vmSP8sWQoiy7c1ldGGKhPdHAdQ yu+eZd2mjM/9J1FacM5Tj3ET6BILO/aJFSZu1vefImxNorD1aus4L949D4aBeGYK484o QU4Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=VQPgZXmmmqsPeLKY0b46Knt9me/j1y2tQ4a5ceDyRQM=; fh=fWFNYUWOegbIYxWggo9g5JSb4Bu33KaYDTJTPMRCnTI=; b=SaqgmGVwDwYFLkqj1hddcLAjXf1Jh1/CfkI8UAIkJR15h48/6TAjFiLS1ybabyXLJC xbQToFhPfcYD8NcmCUgBy8F+B01QLCA4T7LHqFOHTbnwRZefTyiKZz8B6TMY/rywK6N/ e0ZZkTorrlC+FHiRMdPun50S1JApwSMiyLKuveQL8n/bG/JfO+EtUg9ii6h18Iaehn/U HLLEz5GumGZOvdal/7ZuGi1MP1T2ZIyIkQQ4hkSOuwl6fP1JyFHuDexX1Y9Toq5rinf8 XxlUJaBBVM9a50dtlwCPIlc1BWg1DpyDyvnSQ6ImeZnqyRsXMPbQhS4xbRyCZhDtzgJP Psug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=kxHbU8kK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-142485-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142485-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x13-20020a05622a000d00b0043675909527si2428792qtw.82.2024.04.12.03.21.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 03:21:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-142485-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=@linutronix.de header.s=2020 header.b=kxHbU8kK; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-142485-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-142485-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de 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 365521C23A6E for ; Fri, 12 Apr 2024 10:21:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 51BD653E1B; Fri, 12 Apr 2024 10:21:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="kxHbU8kK"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yt8J73xq" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 3EBD653811; Fri, 12 Apr 2024 10:21:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712917271; cv=none; b=N9v5LYE4EWiaZTHEtVmP0bU7ZNW6DZpjMl338CzNF25M9s4PY+LF2yZCcwrJ9V4s5UwrT4ZKSouyHimsTMpuxES2StB2bTY6meFUkktglbK9y1NmbATNH3sE5AZJH1OthAZ1g281Vpdh+mq/idDZBJqO/egA+YOFzHmmq/hEFg8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712917271; c=relaxed/simple; bh=JVyKZModDr1qU8aaxNP3qEOapE9YnY6EJSdPKWcfdLk=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=guHkqP9+kzUcBr4iL5n51I0TtKD7iWEaDLkyAzj1qjOCvpo/UmL3QMwAV6fhI+xvBJV5zbAQcx6kphNkjVeUK7jQHNhVxTXoza7wqxPKzmyTknVkCFshghxIXZnFIMamRnVlcrSCpf915jIUq3L0buY73ss9GJneul5Rmo6FtHI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=kxHbU8kK; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yt8J73xq; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Fri, 12 Apr 2024 10:21:07 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1712917268; h=from:from:sender:sender:reply-to: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=VQPgZXmmmqsPeLKY0b46Knt9me/j1y2tQ4a5ceDyRQM=; b=kxHbU8kKTiyHNB6xvgoXoZxFqJBxxKsdbLVMpfgKrw5UxQ/XiRAwG5WKfRMFBd+zunQCjF MtXyl3OPGj3m2BrzRu3fWXFKsC4lV98gRNUgOu5pFoqS8RyxXzcNYb1bqoUprceLU7jd24 7byF8KI3UB4Js82oYoHgrvQOnJjbS0h5q7R1zvOJbH+bgANvHTMB4Q/UyPrY/GEmEnPhzB HSr4ZAZCqSYu9PiRcwiIThQrW652mElv+LL2jvy3bYN13W8EVQWX8blTW3Xh26nvVBuriz Z5Yw9K1q92WhR7fe/I8itOdMxZDsr1r8D9qEJ9JnAdCXOJpNuZcVSq26bH3buA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1712917268; h=from:from:sender:sender:reply-to: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=VQPgZXmmmqsPeLKY0b46Knt9me/j1y2tQ4a5ceDyRQM=; b=yt8J73xqA9J2wOqH+b/qKLKNC8jVK4jhWjyJrlN0V+uSG1felY6/Wbj9bhZGZSFDTfJPKn a2cPTbZMEddEF8CA== From: "tip-bot2 for Li RongQing" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/merge] x86/sev: Take NUMA node into account when allocating memory for per-CPU SEV data Cc: Li RongQing , Ingo Molnar , Nikunj A Dadhania , "Kirill A. Shutemov" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240412030130.49704-1-lirongqing@baidu.com> References: <20240412030130.49704-1-lirongqing@baidu.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171291726722.10875.2860391498584400458.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/merge branch of tip: Commit-ID: 90167e96588df747c9b47a04ebac59b71e3b413f Gitweb: https://git.kernel.org/tip/90167e96588df747c9b47a04ebac59b71e3b413f Author: Li RongQing AuthorDate: Fri, 12 Apr 2024 11:01:30 +08:00 Committer: Ingo Molnar CommitterDate: Fri, 12 Apr 2024 12:12:11 +02:00 x86/sev: Take NUMA node into account when allocating memory for per-CPU SEV data per-CPU SEV data is dominantly accessed from their own local CPUs, so allocate them node-local to improve performance. Signed-off-by: Li RongQing Signed-off-by: Ingo Molnar Cc: Nikunj A Dadhania Cc: Kirill A. Shutemov Link: https://lore.kernel.org/r/20240412030130.49704-1-lirongqing@baidu.com Signed-off-by: Ingo Molnar --- arch/x86/kernel/sev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/sev.c b/arch/x86/kernel/sev.c index 38ad066..995f944 100644 --- a/arch/x86/kernel/sev.c +++ b/arch/x86/kernel/sev.c @@ -938,7 +938,7 @@ static int snp_set_vmsa(void *va, bool vmsa) #define INIT_LDTR_ATTRIBS (SVM_SELECTOR_P_MASK | 2) #define INIT_TR_ATTRIBS (SVM_SELECTOR_P_MASK | 3) -static void *snp_alloc_vmsa_page(void) +static void *snp_alloc_vmsa_page(int cpu) { struct page *p; @@ -950,7 +950,7 @@ static void *snp_alloc_vmsa_page(void) * * Allocate an 8k page which is also 8k-aligned. */ - p = alloc_pages(GFP_KERNEL_ACCOUNT | __GFP_ZERO, 1); + p = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL_ACCOUNT | __GFP_ZERO, 1); if (!p) return NULL; @@ -1019,7 +1019,7 @@ static int wakeup_cpu_via_vmgexit(u32 apic_id, unsigned long start_ip) * #VMEXIT of that vCPU would wipe out all of the settings being done * here. */ - vmsa = (struct sev_es_save_area *)snp_alloc_vmsa_page(); + vmsa = (struct sev_es_save_area *)snp_alloc_vmsa_page(cpu); if (!vmsa) return -ENOMEM; @@ -1341,7 +1341,7 @@ static void __init alloc_runtime_data(int cpu) { struct sev_es_runtime_data *data; - data = memblock_alloc(sizeof(*data), PAGE_SIZE); + data = memblock_alloc_node(sizeof(*data), PAGE_SIZE, cpu_to_node(cpu)); if (!data) panic("Can't allocate SEV-ES runtime data");