Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 695A0C47DB3 for ; Fri, 2 Feb 2024 14:18:57 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.675061.1050219 (Exim 4.92) (envelope-from ) id 1rVuNI-0004sI-Pg; Fri, 02 Feb 2024 14:18:36 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 675061.1050219; Fri, 02 Feb 2024 14:18:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rVuNI-0004sB-N9; Fri, 02 Feb 2024 14:18:36 +0000 Received: by outflank-mailman (input) for mailman id 675061; Fri, 02 Feb 2024 14:18:35 +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 1rVuNH-0004s5-Gc for xen-devel@lists.xenproject.org; Fri, 02 Feb 2024 14:18:35 +0000 Received: from mail-wm1-x32a.google.com (mail-wm1-x32a.google.com [2a00:1450:4864:20::32a]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id f2acb06e-c1d5-11ee-8a43-1f161083a0e0; Fri, 02 Feb 2024 15:18:34 +0100 (CET) Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-40e7065b7bdso17761715e9.3 for ; Fri, 02 Feb 2024 06:18:34 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id d15-20020adfe88f000000b0033ae50e2c6asm2045835wrm.83.2024.02.02.06.18.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Feb 2024 06:18:33 -0800 (PST) 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: f2acb06e-c1d5-11ee-8a43-1f161083a0e0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1706883513; x=1707488313; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=SOILyzCW1Wg5HSXpticJgJax4Ap7ionOOLE6NJI3tck=; b=BE8dHpiNHjUhF3lT9B7CdDemcftqcJ7neOLLdG2JaMm4WzKELOTpwOahTOL3fM/Jm0 Umtkw+ObJ9hqhZRby/Y5xI0zLsBLG32zffeZfonLEkM2sVoNoIJWiQB4YwOdu0wUOGys H1ArdDJ6z0Dq7GaYt5vWgBw4DomJ6fUybMj/9iyJV+9QBvI2QhSvQzfZE9MUE+HMUchg AQ4S+b6JlinU+z+ZbgHXVpAObnJywAg6TeF4tpNpyK8PpZkYYacgit1FqvqmMwyCJLgz yoBSaWdfxG0J8TBYwmaX8hK1iWhxmbOp6N3tb/iS1ezm6nGLZOPXNeXVf5ZlojKIYBnb JswA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706883513; x=1707488313; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SOILyzCW1Wg5HSXpticJgJax4Ap7ionOOLE6NJI3tck=; b=p4xtMHrOyBKeUygOMXwPepGjmQd0gXgDoAFmIT3eVHxQqywJaA0o3PC/mcH6eGpUBb sGPL0MLrPvLCow+oycvrIsx+N9v2feCn29lgJzdjhOkG1AHd7Y4PuK7j2yHtTBauJseT ICUZz/oFj0/zchS5yEPy82OpdlP2EOjTm3aNSlG+2dUGIea0noCLfzVREY1uI7f9ILu9 jcms4YKHXvemXkcnDwO9pN6tEYd0sH0iSzAEVdosEqUEPCgLjXvViSbN9/I5zAL/WSWB j1jE2VsvFCym3dbpXh3lN2d0dVAQcUAJj4gCdD4gOJYkCi+cbnu/vP2kyPG3B9Dlxbki 5Jgg== X-Gm-Message-State: AOJu0YzTX24fXKrIQPFP1/bQCYp20oEGKCf5LLRqjt6nIxyLj4fkOz/e L7AXgnZFCLIZSw05CiF5AJcoL1hEdrr4tWIN5cQcXjKc7aQYPnQq2kz1nOjG2g== X-Google-Smtp-Source: AGHT+IERUYrnNY+7x/uaQU/FjXIWwena/40Nz5zy3aYEgQfSfbvY55Nu8dH0/4K0k8oJrqxlgoSWPQ== X-Received: by 2002:adf:9b94:0:b0:337:c39a:1fbd with SMTP id d20-20020adf9b94000000b00337c39a1fbdmr3977032wrc.42.1706883513446; Fri, 02 Feb 2024 06:18:33 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCURzqLoDH8bBm8y8bF9oEdOWHtoDVuxjuXmCCIRAtFhafGqp64T2Z68kbmbghUCW7tNnrPSQPPRVCZUBGi78XvqzY8eIoBTyl+KfOmN2kDjRdPUPRNYG+gtUruJ0/TM7f25Xigf Message-ID: <9eeb91f9-c33a-4d2c-ace6-55cc035470d6@suse.com> Date: Fri, 2 Feb 2024 15:18:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] x86/CPU: convert vendor hook invocations to altcall Content-Language: en-US To: Andrew Cooper Cc: Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= , "xen-devel@lists.xenproject.org" References: <27d828d2-fb4b-41fe-82e8-90720bd9ff8f@suse.com> From: Jan Beulich Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaS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MFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 02.02.2024 13:13, Andrew Cooper wrote: > On 23/01/2024 11:00 am, Jan Beulich wrote: >> While not performance critical, these hook invocations still want >> converting: This way all pre-filled struct cpu_dev instances can become >> __initconst_cf_clobber, thus allowing to eliminate further 8 ENDBR >> during the 2nd phase of alternatives patching (besides moving previously >> resident data to .init.*). >> >> Since all use sites need touching anyway, take the opportunity and also >> address a Misra C:2012 Rule 5.5 violation: Rename the this_cpu static >> variable. >> >> Signed-off-by: Jan Beulich > > Acked-by: Andrew Cooper Thanks. >> --- >> With LTO it might end up necessary to tag as __used more than just >> "default_cpu". > > Why is it even needed here? > > LTO can't rid early_cpu_init() of the default clause, so can't make > default_cpu unreferenced, I don't think. Even without LTO I've actually seen gcc eliminate default_cpu. The use in early_cpu_init() simply was expanded to assignments, rather then something memcpy()-like. >> Perhaps __used would better be integrated into __initconst_cf_clobber, >> to be independent of the compiler potentially eliding structure >> instances. > > Maybe.  I guess the issue here is that the tools really can't see the > connection between being in the clobber section, and alternatives going > and making a modification. The const-ness is the issue, I expect. From that the compiler can infer that it may transform use of the variable into something which in the end doesn't require the variable anymore. And it can't know that we use all contributions to that section for a second purpose. Jan