Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp4620742rwb; Mon, 8 Aug 2022 04:30:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR7fdbJEK+C+hPL2z4+UVMLznaPOXj8ODpl/JBGFx8IY/CuH3cPVIKs4JbeHc06Qa4Mizk3g X-Received: by 2002:a17:902:d508:b0:16f:736:33a5 with SMTP id b8-20020a170902d50800b0016f073633a5mr17789209plg.31.1659958244325; Mon, 08 Aug 2022 04:30:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659958244; cv=none; d=google.com; s=arc-20160816; b=ccgAfZzf7+tryzK4npQsh58DiLVr+N3GHMXnDSyQRz9dqNiU/Iv1q7N52uLJfWCueS Dy0+QUPtE9x+RYFzN6MTk6H+gyfR1Il3EEAs5+nnjTirLnFFTrUoCjIVcrUiyrLvdbRy DxNhNvCOmchCVmeWHHtzCiw/l9X+JWB76Pjobp8XcRbAtz8DSJey9Pq8MZGNk6DyBRyE QzOdeVZqQRVpACE5kUSLKXx77d6bufY9pYLrZmjNVu1La+vmzQDyj3Vq70jmKr7a6/Dk xWD8teefXY7UiI4HAn1n+b7RifHwVPVmxS4ODK+vJAXdPAgoEiF8eWCQXgdDv+8sLfnE 4W2g== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:sender:dkim-signature; bh=jE7rDzDJl54ngSeDSzix1uvFy6MwH/Sd6J9jXSbtUjE=; b=sJQLkAtjAMR3026XoDC92JA7BMn7n+rgTCoUwS2KmXx6yGv2TkRkk6ex5uiEh6yPxh nvIVYmZwg5C8JphT+Dkm2Yx1UguYO3pFy4ErVzexxQb5vS1y4INJJGuxA503mwzYaGH0 vGSrI+mU3jEHnEg7M4wPy9CXMvB1Jqn96iqD2356xB593NdLjcqS4H/etrpbQmp2q1Hu gFH5wn8ObOaXt9RFvDThJ+elnAcKKZowMFAJjT55PilyumOPYAxPdhJzXXr99Z0ZHz08 pv3Dh1EkpOUKUsuhOkkbqtKt83lUgv4L1cFTQx7/eaAC5Nh71mmwjcgrDb1EvJ5EE3Ng yw/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="jOeH74/b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l192-20020a6391c9000000b0041183daa0ffsi5469260pge.761.2022.08.08.04.30.29; Mon, 08 Aug 2022 04:30:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="jOeH74/b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237889AbiHHLDb (ORCPT + 99 others); Mon, 8 Aug 2022 07:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231703AbiHHLD3 (ORCPT ); Mon, 8 Aug 2022 07:03:29 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C341555B8 for ; Mon, 8 Aug 2022 04:03:28 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id r4so10796380edi.8 for ; Mon, 08 Aug 2022 04:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jE7rDzDJl54ngSeDSzix1uvFy6MwH/Sd6J9jXSbtUjE=; b=jOeH74/bjd+f49sRgyezy7cILVoSDE6hWrGLBmU8FhuyWct9gaEdqyi62ahrDhXyUY P+niYKnvQCnOJZluZ4D6WSbGqN/8Jin+1P4yZ6x+29OnP72ghuUx+NCI0zIMIMdpR2Q4 mBAK44TczmFLT8HMVzC4lWZu50/0UYVMXGEqy2KkgEInFjDEdHbyZ8SrwCgFXlXO1vbf WLbhTMPeV7dg//pLx07m3PqeEwSQ7pBXucII4jxufMMjuJk73Pg2HcetCxHvPWHHREc+ 4vuVvcUgWtmPPybvD76iwXqf0hZzZhuslcotwFRXhw/KEanZyvKBGPG6WgUdPn/uVWf3 5oHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=jE7rDzDJl54ngSeDSzix1uvFy6MwH/Sd6J9jXSbtUjE=; b=BEo7sBkJ/YZAywBXd7un/wlHNvIq16y7NDA4Gt+aNnvdzgzZPqk19uIOQOR1Y9t7Kf ExXoUYk8daq8nl2A+LSewNyNsDhfFsvzInyGyRN5Y3ZGDYKGn0LsKel+U+TCZLjFQIcu iPIldqkgR+W+ZQQlxi7SlI2Qfd7jKJ8LwTfRQpxrWla38EdXiT5JMb/JkNlpBJBHPpPs ZTL9kKz1LRrNzhAZhYBhdPSZOxxc24y5fprZSDRtTYr4AB739dSsfAwGNtHNaZVc9nvt h3SO8wqnWpx8bt1eE20p7IVgm9vv6OzeH8w9Fu94BbfEFhoqvRiSaVnmJV//7fDuAtPd whgQ== X-Gm-Message-State: ACgBeo01gTEAO6AUIuKzE0bdAMKh3EXLaPVmQCS5OdtjU7XksuqhIdI3 LIF7cbBnkeOex0xbyPW1IsQ= X-Received: by 2002:aa7:cc13:0:b0:43d:4c1:3806 with SMTP id q19-20020aa7cc13000000b0043d04c13806mr17121364edt.129.1659956607282; Mon, 08 Aug 2022 04:03:27 -0700 (PDT) Received: from gmail.com (195-38-112-141.pool.digikabel.hu. [195.38.112.141]) by smtp.gmail.com with ESMTPSA id jw16-20020a170906e95000b00726298147b1sm4815522ejb.161.2022.08.08.04.03.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Aug 2022 04:03:26 -0700 (PDT) Sender: Ingo Molnar Date: Mon, 8 Aug 2022 13:03:24 +0200 From: Ingo Molnar To: Ira Weiny , Andy Lutomirski Cc: Borislav Petkov , Dave Hansen , Rik van Riel , x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [RFC PATCH 5/5] x86/entry: Store CPU info on exception entry Message-ID: References: <20220805173009.3128098-1-ira.weiny@intel.com> <20220805173009.3128098-6-ira.weiny@intel.com> <5d62c1d0-7425-d5bb-ecb5-1dc3b4d7d245@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=1.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, FSL_HELO_FAKE,HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Ira Weiny wrote: > On Sun, Aug 07, 2022 at 12:35:03PM +0200, Borislav Petkov wrote: > > On Sun, Aug 07, 2022 at 12:02:41PM +0200, Ingo Molnar wrote: > > > * Borislav Petkov wrote: > > > > With the amount of logical cores ever increasing and how CPU packages > > > > (nodes, L3 sharing, you name it) get more and more complex topology, > > > > I'd say the 2 insns to show the CPU number in every exception is a good > > > > thing to do. > > > > > > We can show it - I'm arguing against extracting it too early, which costs > > > > Not early - more correct. We can say which CPU executed the exception > > handler *exactly*. Not which CPU executed the exception handler *maybe*. > > > > > us 2 instructions in the exception fast path > > > > 2 insns? They don't matter at all. FWIW, they'll pull in the per-CPU > > cacheline earlier which should be a net win later, for code which does > > smp_processor_id(). I'd like to hear what Andy Lutomirski thinks about the notion that "2 instructions don't matter at all" ... Especially since it's now 4 instructions: > I agree with Boris; however I feel that I have to mention that in patch > 3/5 you also have 1 instruction on each of entry and exit to push the > extra stack space. So all told it would cost 4 instructions. ... 4 instructions in the exception path is a non-trivial impact. > Again, I don't believe this is too much overhead but I don't want people > to say it was not discussed. Is it necessary to do this, what are the alternatives, can this overhead be avoided? Thanks, Ingo