Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5134088rwb; Mon, 8 Aug 2022 12:49:25 -0700 (PDT) X-Google-Smtp-Source: AA6agR5d/T95N/JZ+POYi7OlTyEpONLQ+k4pySeu6pee7xXZS25TXn3IUSKTNScdDc77h1wg2qJ3 X-Received: by 2002:a05:6a00:148c:b0:52e:a630:afc7 with SMTP id v12-20020a056a00148c00b0052ea630afc7mr18197526pfu.0.1659988164854; Mon, 08 Aug 2022 12:49:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659988164; cv=none; d=google.com; s=arc-20160816; b=f+tlD/yEFpr+QSZp3Z5/lvlO2+Uen1Usu1wpqiheZoZ0BKKmfdkxn2+asQRC34ZslK Yq6/jc3K4xJxMpfM02mfVslObmSRpJoeA5zbbJCRHLFeo7EIWwkBG5rPJaUnInBYmqmK 48iawAAlteRemtKSe3WlywZoiMXNfqF3lHlSTDDe8RzUwdIb3SSEweGGDhFs4CCYQ0n0 tIssw9D1rrLBV+et7m8MaKRPQ+sQKjZsR3gR+iM8qrTKH3DbdUbMOINR0M+O5eg8L/wp u11TRO7BZv2PxuV/lurODlXEvUMWXoYTndwrFXsprKOLT52GAp5qbWtXQkuOYPHbNzGf iVJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature:dkim-filter; bh=xT4zVgVYZD2M2KKjxqc9/0tArQ9kU5/YMmYbg8guPiQ=; b=OLc27jZv1H0lLMJKbDGuCasMDXyFi4TEhWKpFhFcWf9Aq+wYZxO0Fwo96oN5niIaFZ YHgz6qDjs20LmaESeGgGqEi44Z4ED2h4yeNLQzt+M87kcKM753HtQtDkc0zDbcC/e58X K+0XKRMmpFQ6+LOqXaOygYqbYgPkXLMmCMUedyMn9at04h7apzfrzG9Y70uFX3+J0ajG Y0RfBz2f+E+/ce8BNgKlVM50TJBC6AQkuclB1R+8gAiFrnZY6gpNom2cNaO83ND36Odx xzQY8gv9B1wYhCK7CAufNdKNPs4n5aGtMGoqSJyIbKEu4f7MjAOcsnZ59ks+C9W+siig QL/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2022080501 header.b="fcVx8/9G"; 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=zytor.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dw3-20020a17090b094300b001f2ef2c840dsi14758605pjb.18.2022.08.08.12.49.09; Mon, 08 Aug 2022 12:49:24 -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=@zytor.com header.s=2022080501 header.b="fcVx8/9G"; 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=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243789AbiHHTBD (ORCPT + 99 others); Mon, 8 Aug 2022 15:01:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244112AbiHHTAf (ORCPT ); Mon, 8 Aug 2022 15:00:35 -0400 Received: from mail.zytor.com (unknown [IPv6:2607:7c80:54:3::138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E33ED39C for ; Mon, 8 Aug 2022 12:00:33 -0700 (PDT) Received: from [IPV6:2601:646:8600:40c0:425:cd56:6750:e1bf] ([IPv6:2601:646:8600:40c0:425:cd56:6750:e1bf]) (authenticated bits=0) by mail.zytor.com (8.17.1/8.17.1) with ESMTPSA id 278IxxCq011416 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Mon, 8 Aug 2022 11:59:59 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 278IxxCq011416 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2022080501; t=1659985200; bh=xT4zVgVYZD2M2KKjxqc9/0tArQ9kU5/YMmYbg8guPiQ=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=fcVx8/9GZWVJJZB8jJQ5SSeYdgryT41UC9o/a+CYvwzhZeFyr9nrs6sws4vURRld5 aBBZzrq76iXK6TdbWxiK3m2CPqWU+ZpFW+1K6pAg6LnQiH8dO8e9MGCZcpY40ganRT 1Fc02rz5qygc22XiwhWIXziz+59cc53QZtDRbvMBIiQJgc4I3YE/LJOFy9zETQ75oi mzn6pdgeBoBsLqqNgLpDOPMlJ9/SW0jt1V5pIHJH5l9vDk8NS1VsUqPwW5SnLe7V9S Bm0+Aw3RmH6MN9ZxK4V25zKwdPfh8X04E9zXl+I8kEExUVxNStGUFNSdHzKcnZZEOH FvL4xGSduJPQA== Message-ID: <09d75b16-841b-0eaa-eff6-66673c7c019b@zytor.com> Date: Mon, 8 Aug 2022 11:59:54 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 From: "H. Peter Anvin" Subject: Re: [PATCH] x86/acrn: Improve ACRN hypercalls To: Dave Hansen , Uros Bizjak Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen References: <20220804180358.32944-1-ubizjak@gmail.com> <91ccae0b-6135-6163-f59b-4e99624090a5@intel.com> <6c516a7c-ac97-e0b1-b056-06a17d1b7420@intel.com> Content-Language: en-US In-Reply-To: <6c516a7c-ac97-e0b1-b056-06a17d1b7420@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RDNS_NONE, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 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 On August 4, 2022 12:03:56 PM PDT, Dave Hansen wrote: >On 8/4/22 11:56, Uros Bizjak wrote: >> The %r8 is not preserved across function calls, so your statement >> above is correct. But as long as there is no function call *between* >> the variable definition and the assembly, the approach with the local >> register variable works without any problems. It is even something GCC >> itself has used in its library for years. > >I'm glad it's workout out for GCC. But, the kernel is not GCC. I >specifically asked for the ACRN code to be the way that it is today and >your argument is not making me reconsider it in the slightest. > >So, thanks for the patch, but I don't think we should apply it. Well, this is universally used, so it isn't going to break. x86 is kind of unique in that it often doesn't need it, because it has predicates for so many of the specific registers, but even x86 needs it for inlining system calls in glibc, for example. There is a way to do it right, which is to wrap the assignments (which don't have to be the declarations, but customarily are) and asm() statements in a block (e.g. an inline function, but can also just be a plain old statement block.)