From nobody Tue Feb 10 01:59:18 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1655977599; cv=none; d=zohomail.com; s=zohoarc; b=i5w5eCvy+ypr+/yN/vyTzjPHbRjwRkhjqiFXqfPcZ5iteI+oNQoMZ4TT/K/B82Ab7Hsm2sxbffxkQ+nKskeHJNzLjf3b9cqESS7AVy9qPItMkJx37bF1/e/tGwV/5brUkhGmK99Jc2LPBDvRFnLELnP3DAdKc5b9s4+ZeLALUpo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1655977599; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qOrZ3a0atU/z4XGkVjCM42/CYfuowe8zJtC3IRIryL4=; b=ILjMhlEVDjw7s7FAncllYoRYZwJIAG8m+TlhrJxe/xfGqDd5DzkmcXdcRzN1Hr4AT+xX+p2yzU28EJmMwtzhhIHgLlogF5v6M2935GDT2Vqxird1jDvgep+ClN59QHKuMsxBlN3lEc3J8lllyj6HQ2oxVf6N+cNgJNfqWie3SRs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1655977599539851.2789734719726; Thu, 23 Jun 2022 02:46:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.354727.581989 (Exim 4.92) (envelope-from ) id 1o4JPj-00009o-MN; Thu, 23 Jun 2022 09:46:15 +0000 Received: by outflank-mailman (output) from mailman id 354727.581989; Thu, 23 Jun 2022 09:46:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o4JPj-00009h-J5; Thu, 23 Jun 2022 09:46:15 +0000 Received: by outflank-mailman (input) for mailman id 354727; Thu, 23 Jun 2022 09:46:14 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1o4JPi-0008LX-2t for xen-devel@lists.xenproject.org; Thu, 23 Jun 2022 09:46:14 +0000 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 50575c74-f2d9-11ec-bd2d-47488cf2e6aa; Thu, 23 Jun 2022 11:46:11 +0200 (CEST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6F2CA21CF6; Thu, 23 Jun 2022 09:46:11 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1B7CF133A6; Thu, 23 Jun 2022 09:46:11 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id QPVlBWM2tGLmLwAAMHmgww (envelope-from ); Thu, 23 Jun 2022 09:46:11 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 50575c74-f2d9-11ec-bd2d-47488cf2e6aa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1655977571; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qOrZ3a0atU/z4XGkVjCM42/CYfuowe8zJtC3IRIryL4=; b=CY+aACXb8FTwdvlK2MD+8Ue/Ep+AuaiXD4J2b/dJwMFgM+Cr8HwRI0sA5M0QA78pAqdvsr 3Wy5n6qTS4x9KZcf/S2ffLR4puT/FnYCgKNVJuftwlxmFmOANRIxWolPgpkpPWtaqQ+hho V/uuve6jQ8m5GFkEDaoknN9kv4J73Vk= From: Juergen Gross To: xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Boris Ostrovsky , Jan Beulich Subject: [PATCH v2 1/3] x86/xen: use clear_bss() for Xen PV guests Date: Thu, 23 Jun 2022 11:46:06 +0200 Message-Id: <20220623094608.7294-2-jgross@suse.com> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220623094608.7294-1-jgross@suse.com> References: <20220623094608.7294-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1655977601573100005 Content-Type: text/plain; charset="utf-8" Instead of clearing the bss area in assembly code, use the clear_bss() function. This requires to pass the start_info address as parameter to xen_start_kernel() in order to avoid the xen_start_info being zeroed again. Signed-off-by: Juergen Gross Reviewed-by: Jan Beulich --- arch/x86/include/asm/setup.h | 3 +++ arch/x86/kernel/head64.c | 2 +- arch/x86/xen/enlighten_pv.c | 8 ++++++-- arch/x86/xen/xen-head.S | 10 +--------- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h index f8b9ee97a891..f37cbff7354c 100644 --- a/arch/x86/include/asm/setup.h +++ b/arch/x86/include/asm/setup.h @@ -120,6 +120,9 @@ void *extend_brk(size_t size, size_t align); static char __brk_##name[size] =20 extern void probe_roms(void); + +void clear_bss(void); + #ifdef __i386__ =20 asmlinkage void __init i386_start_kernel(void); diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index bd4a34100ed0..e7e233209a8c 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -426,7 +426,7 @@ void __init do_early_exception(struct pt_regs *regs, in= t trapnr) =20 /* Don't add a printk in there. printk relies on the PDA which is not init= ialized=20 yet. */ -static void __init clear_bss(void) +void __init clear_bss(void) { memset(__bss_start, 0, (unsigned long) __bss_stop - (unsigned long) __bss_start); diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index e3297b15701c..70fb2ea85e90 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1183,15 +1183,19 @@ static void __init xen_domu_set_legacy_features(voi= d) extern void early_xen_iret_patch(void); =20 /* First C function to be called on Xen boot */ -asmlinkage __visible void __init xen_start_kernel(void) +asmlinkage __visible void __init xen_start_kernel(struct start_info *si) { struct physdev_set_iopl set_iopl; unsigned long initrd_start =3D 0; int rc; =20 - if (!xen_start_info) + if (!si) return; =20 + clear_bss(); + + xen_start_info =3D si; + __text_gen_insn(&early_xen_iret_patch, JMP32_INSN_OPCODE, &early_xen_iret_patch, &xen_iret, JMP32_INSN_SIZE); diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S index 3a2cd93bf059..13af6fe453e3 100644 --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S @@ -48,15 +48,6 @@ SYM_CODE_START(startup_xen) ANNOTATE_NOENDBR cld =20 - /* Clear .bss */ - xor %eax,%eax - mov $__bss_start, %rdi - mov $__bss_stop, %rcx - sub %rdi, %rcx - shr $3, %rcx - rep stosq - - mov %rsi, xen_start_info mov initial_stack(%rip), %rsp =20 /* Set up %gs. @@ -71,6 +62,7 @@ SYM_CODE_START(startup_xen) cdq wrmsr =20 + mov %rsi, %rdi call xen_start_kernel SYM_CODE_END(startup_xen) __FINIT --=20 2.35.3