Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp600896pxh; Tue, 9 Nov 2021 16:00:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxIrgyZcnhPV+YkgdcklS+FJpNAccEJeLw2jvxQf3E0X9pOzQj7L+RphhRcnLEbtOd+YCjD X-Received: by 2002:a05:6602:280f:: with SMTP id d15mr7159346ioe.150.1636502411505; Tue, 09 Nov 2021 16:00:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636502411; cv=none; d=google.com; s=arc-20160816; b=ht/+PabX2UZCJyZzhUJdWCd990129EaF1n5j3oR0Wt1RhB5NFj62anGIx02wQe68NM w0OCa0+oPRaY7LeeoSoc5MKa2MQ84hLh84Jl0c0l+F9PamjlqFoswFDaHCJdAhtap97S 8oUTIeOL/VJadxzf0LCq3PADYJCgM2LRsCvE09A82ggpO8OpJZX0gM8xfsfTVQp0SgAw 7kZpt18Ah92I2nCYw6ZQG75rioCX72DrDBU7JqctT/1MFZBMR7NWtGnj5z47njLNj/oh mbcKZ+mqBzsk/voqsPPXlA7MzuPxMInpVCM/DMk4rDD+LQbuQCbFv8Q+ZXghsAPPdl9u cjaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=jnHKpEZ2Xu28NQThFUXRYmIPCDni5z/NZIr/efA6+nw=; b=XkWqTZE03h9scjfH3jwQBcyizfiJhajD9mV7aZ5Pw1tVwlXvRlcmu7yMjcyQCf+0jQ nDLRY2wfGqYy40K0Gtz5jK+HuF30XPk4SazLZ6GLro3YsZfGoxJkdHZaQ6AXiAQo1/uY BHwq4B2b+5xtxy4QA/3jhj0gwEO6F63ld2DaMKd4gmDw2F3QLobIcT4xfv1nzXSLJ4OW MAlkNrqsOfXphCvLScJW6Zl57NpU+kEDniv7rp6XYMQ3EVN0TeDE5dS21jfDtT8t2djz HrBEcWNhi7d9M1xtjGqRTRc87JLcAdOjwrhfePCqLgrJch7L3aEJl/DokFl4XttFoY3f FaUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="p/nmzY50"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si45319300ila.24.2021.11.09.15.59.58; Tue, 09 Nov 2021 16:00:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="p/nmzY50"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235706AbhKIPN7 (ORCPT + 97 others); Tue, 9 Nov 2021 10:13:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231272AbhKIPN6 (ORCPT ); Tue, 9 Nov 2021 10:13:58 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6323CC061764 for ; Tue, 9 Nov 2021 07:11:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=jnHKpEZ2Xu28NQThFUXRYmIPCDni5z/NZIr/efA6+nw=; b=p/nmzY50Su/dpNlKwLu21GjINz 7Vg+NQppmuRQhBfCLX7MkqiOrHHuyo+RMc1PJbA9JJvfcSGA3vYxTXKIUDEpwGFtlLsyW3027B3we YKn50VWCZmLj3irnqJHmw4RPtcYtxTnHnp9tLq1H404CJqVSbqTXcB5iETQi66QFPg/djT9RXARfk 9/vXEzy5SrHO9vkbyBkNxgFOaogxlmIrMA1WswlwkkR0oYZx5iIDF2ZZ4tgBPZtgKJG29aHPe/EPk 0rUQClGsQlIWXGHirfNM4iCihJQsl1Ro8oRhoHEpJ4ltauQHbQcP2/1FvxZT87FA6d01x1crVW9np I2y3BHnw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mkSlt-00F5Mq-0L; Tue, 09 Nov 2021 15:10:49 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id A3DBB3000A3; Tue, 9 Nov 2021 16:10:47 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 8DD472082F4A7; Tue, 9 Nov 2021 16:10:47 +0100 (CET) Date: Tue, 9 Nov 2021 16:10:47 +0100 From: Peter Zijlstra To: Boris Ostrovsky Cc: linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, tglx@linutronix.de, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, jgross@suse.com Subject: Re: [PATCH] x86/smp: Factor out parts of native_smp_prepare_cpus() Message-ID: References: <1635896196-18961-1-git-send-email-boris.ostrovsky@oracle.com> <48fb48fa-c65d-8e38-dabb-cf9be21365ca@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <48fb48fa-c65d-8e38-dabb-cf9be21365ca@oracle.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 08, 2021 at 12:20:26PM -0500, Boris Ostrovsky wrote: > > On 11/8/21 10:11 AM, Peter Zijlstra wrote: > > On Tue, Nov 02, 2021 at 07:36:36PM -0400, Boris Ostrovsky wrote: > > > Commit 66558b730f25 ("sched: Add cluster scheduler level for x86") > > > introduced cpu_l2c_shared_map mask which is expected to be initialized > > > by smp_op.smp_prepare_cpus(). That commit only updated > > > native_smp_prepare_cpus() version but not xen_pv_smp_prepare_cpus(). > > > As result Xen PV guests crash in set_cpu_sibling_map(). > > > > > > While the new mask can be allocated in xen_pv_smp_prepare_cpus() one can > > > see that both versions of smp_prepare_cpus ops share a number of common > > > operations that can be factored out. So do that instead. > > > > > > Fixes: 66558b730f25 ("sched: Add cluster scheduler level for x86") > > > Signed-off-by: Boris Ostrovsky > > Thanks! I'll go stick that somewhere /urgent (I've had another report on > > that here: > > > > https://lkml.kernel.org/r/20211105074139.GE174703@worktop.programming.kicks-ass.net > > ) > > > Thank you. (I don't see this message btw) Urgh, that thread never went to lkml :/ > > But looking at those functions; there seems to be more spurious > > differences. For example, the whole sched_topology thing. > > > I did look at that and thought this should be benign given that Xen PV > is not really topology-aware. I didn't see anything that would be a > cause for concern but perhaps you can point me to things I missed. And me not being Xen aware... What does Xen-PV guests see of the CPUID topology fields? Does it fully sanitize the CPUID data, or is it a clean pass-through from whatever CPU the vCPU happens to run on at the time? > > Should we re-architect this whole smp_prepare_cpus() thing instead? Have > > a common function and a guest function? HyperV for instance seems to > > call native_smp_prepare_cpus() and then does something extra (as does > > xen_hvm). > > > Something like > > > void smp_prepare_cpus() > > { > > ??? // Code that this patch moved to smp_prepare_cpus_common(); > > > ?? smp_ops.smp_prepare_cpus();? // Including baremetal > > } > > > ? > > > XenHVM and hyperV will need to call native smp_op too. Not sure this > will be prettier than what it is now? Hurmph, yeah. I was thinking it would allow pre and post common code, but yeah, doesn't seem to make sense for now.