From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 87802C433E0 for ; Mon, 11 Jan 2021 17:12:35 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 312D221919 for ; Mon, 11 Jan 2021 17:12:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 312D221919 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:45560 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kz0k6-0005Ju-7J for qemu-devel@archiver.kernel.org; Mon, 11 Jan 2021 12:12:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:48952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kz0eH-0006nL-Do for qemu-devel@nongnu.org; Mon, 11 Jan 2021 12:06:33 -0500 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]:34724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kz0eC-0005Sm-UY for qemu-devel@nongnu.org; Mon, 11 Jan 2021 12:06:33 -0500 Received: by mail-pl1-x630.google.com with SMTP id t6so176250plq.1 for ; Mon, 11 Jan 2021 09:06:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=dK82wjkfuAUt/ix/gjuetbOsvwcK7HmGxCJnWH63744=; b=ams0f/YPuBmBuCW9qHPWWZK5ZzQO+cZzVlTJILnLy3QG5Ug1oUtozM7dlC9MdmicQE 8bsP09pP+4+DQAservGlADMKD47ivqaUEb+uvU/71kS0elhuE2i0YDMlKIyrURzlV3kE xZikrVlFmWw+AbeWpQg4QJqgkN6vGimSiccLu/5Ayri0OdLr9e6N80bxqk5WBBAwLw0r qtgebzhmj93coNu2BVkwl38B4i5xk6Z26JC4I4zUr4tfqQJqIw/HkyndCffQUwpBjCqD nbwtiUhTIS9U3yObPdF7GH/gY5lLOIfDqDNxFCweCTzrWtd3oOWGq/udzKzblBAe4Nxf Jn7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dK82wjkfuAUt/ix/gjuetbOsvwcK7HmGxCJnWH63744=; b=FNPjr+TAfFN+2qVjA5Do2nGGpzQB5ItjByk9Bk2q4nhqnQuo5ExbzlMoWLT4enJAO2 xv88ZnO16VTZdjxIRaVGBxW8Ybte7BBeuph53NoyU/A4Fw79a3FEY9ezxEKPEwFN/lzT JB5LaNku/ClBpCy6vHaI0IbTrmyat+6WIqZAKeqWAgiLQj98huhMA8S8cqL1ZTZEjk9W //e2Kz9C1/mtfTevyuciZq8FbSqwyFlz03IVRRMjgtVB2KhcWVDbxxMlYCYsPsKQRXIz yKPU4MFUxUVqznpTbd0nokxY/ncq6i/z4RnS6Jtxz8x6987O+fI+p9+eoipIsH5cHc0Q yloA== X-Gm-Message-State: AOAM532nkhjVA5xzPAIfoEN+GHxidbG3wX2aGqWpeNK8X/ZGvddQbFk8 oGlKiWBYpZoh81V4yWVUYCkaCQ== X-Google-Smtp-Source: ABdhPJwEjYGUezB1r4Orllhy0pxrGMZeEU6Tmzr7s4drBQ1tU2V2AFEfFE1cVn8M9MYIL0zMcr7S8A== X-Received: by 2002:a17:902:b584:b029:dc:1425:e5af with SMTP id a4-20020a170902b584b02900dc1425e5afmr682857pls.3.1610384786741; Mon, 11 Jan 2021 09:06:26 -0800 (PST) Received: from [10.25.18.119] (rrcs-173-197-107-21.west.biz.rr.com. [173.197.107.21]) by smtp.gmail.com with ESMTPSA id a9sm163208pfn.178.2021.01.11.09.06.24 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 11 Jan 2021 09:06:26 -0800 (PST) Subject: Re: [PATCH] hvf: guard xgetbv call. To: Roman Bolshakov References: <8da22f7f-7379-cffe-5fdd-94fd5ddece32@linaro.org> <4a24ae1a-8114-a840-b6bf-ae3a301f6232@linaro.org> From: Richard Henderson Message-ID: <259b9e96-1f69-4e4a-16ef-7034e19ed1ef@linaro.org> Date: Mon, 11 Jan 2021 07:06:22 -1000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::630; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x630.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , QEMU Developers , Cameron Esfahani , John Arbuckle , Hill Ma , Paolo Bonzini , Richard Henderson Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 1/10/21 6:31 PM, Roman Bolshakov wrote: >> Also, if we're going to put this some place common, forcing the caller to do >> the cpuid that feeds this, then we should probably make all of the startup >> cpuid stuff common as well. >> > > I proposed the version because all callers of xgetbv instruction already > call cpuid before invoking inline xgetbv. > >> Note that we'd probably have to use constructor priorities to get that right >> for util/bufferiszero.c. >> > > Please correct me if I read this wrong. What you're saying is we should > initialize cpuid in constructors and then use cached cpuid ecx in > xgetbv() (and drop one argument, respectively)? I would have xgetbv and all of the cpuid values cached at startup, and all three places would read global variables. r~