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=-8.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 96331C4363D for ; Fri, 2 Oct 2020 10:31:33 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 3B3CC2068E for ; Fri, 2 Oct 2020 10:31:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=suse.com header.i=@suse.com header.b="rtpwkhk5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3B3CC2068E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.1851.5604 (Exim 4.92) (envelope-from ) id 1kOILT-00057W-TN; Fri, 02 Oct 2020 10:31:23 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1851.5604; Fri, 02 Oct 2020 10:31:23 +0000 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" Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kOILT-00057O-Q9; Fri, 02 Oct 2020 10:31:23 +0000 Received: by outflank-mailman (input) for mailman id 1851; Fri, 02 Oct 2020 10:31:23 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kOILS-00057E-U5 for xen-devel@lists.xenproject.org; Fri, 02 Oct 2020 10:31:22 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b63be9c4-bfab-490c-a2d5-91617c0cb1db; Fri, 02 Oct 2020 10:31:22 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 66089ABF4; Fri, 2 Oct 2020 10:31:21 +0000 (UTC) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kOILS-00057E-U5 for xen-devel@lists.xenproject.org; Fri, 02 Oct 2020 10:31:22 +0000 X-Inumbo-ID: b63be9c4-bfab-490c-a2d5-91617c0cb1db Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b63be9c4-bfab-490c-a2d5-91617c0cb1db; Fri, 02 Oct 2020 10:31:22 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1601634681; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=50n6CMMT53yibknPmzAVv0OIHH8++s0mbagd45BQItU=; b=rtpwkhk5lVRRsvdTEvZyzPS8JSiXLrgoPCsiIVkZ/StQYZmC0uAZy5XGtju1EdjBQkJOwA eMA9Bt0S1AlQ0ZrKV3nB8Q4iukZAlitNSEiNBlg8ZYFwIW0aAIB3gkwPBz497cBsZfU4fu au/eHXABS3oVUv47GNspz0P4RgexuY0= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 66089ABF4; Fri, 2 Oct 2020 10:31:21 +0000 (UTC) Subject: [PATCH 3/3] x86/vLAPIC: vlapic_init() runs only once for a vCPU From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <1a55f2f0-f0aa-4a33-1219-1091ed9150df@suse.com> Message-ID: <3735eb75-76ef-abff-1b05-aa89ddc39fcc@suse.com> Date: Fri, 2 Oct 2020 12:31:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <1a55f2f0-f0aa-4a33-1219-1091ed9150df@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Hence there's no need to guard allocation / mapping by checks whether the same action has been done before. I assume this was a transient change which should have been undone before 509529e99148 ("x86 hvm: Xen interface and implementation for virtual S3") got committed. While touching this code, switch dprintk()-s to use %pv. Signed-off-by: Jan Beulich --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -1610,27 +1610,21 @@ int vlapic_init(struct vcpu *v) vlapic->pt.source = PTSRC_lapic; - if (vlapic->regs_page == NULL) + vlapic->regs_page = alloc_domheap_page(v->domain, MEMF_no_owner); + if ( !vlapic->regs_page ) { - vlapic->regs_page = alloc_domheap_page(v->domain, MEMF_no_owner); - if ( vlapic->regs_page == NULL ) - { - dprintk(XENLOG_ERR, "alloc vlapic regs error: %d/%d\n", - v->domain->domain_id, v->vcpu_id); - return -ENOMEM; - } + dprintk(XENLOG_ERR, "%pv: alloc vlapic regs error\n", v); + return -ENOMEM; } - if (vlapic->regs == NULL) + + vlapic->regs = __map_domain_page_global(vlapic->regs_page); + if ( vlapic->regs == NULL ) { - vlapic->regs = __map_domain_page_global(vlapic->regs_page); - if ( vlapic->regs == NULL ) - { - free_domheap_page(vlapic->regs_page); - dprintk(XENLOG_ERR, "map vlapic regs error: %d/%d\n", - v->domain->domain_id, v->vcpu_id); - return -ENOMEM; - } + free_domheap_page(vlapic->regs_page); + dprintk(XENLOG_ERR, "%pv: map vlapic regs error\n", v); + return -ENOMEM; } + clear_page(vlapic->regs); vlapic_reset(vlapic);