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=-17.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable 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 6851CC10F09 for ; Wed, 27 Jan 2021 00:35:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4282120679 for ; Wed, 27 Jan 2021 00:35:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404382AbhA0AcI (ORCPT ); Tue, 26 Jan 2021 19:32:08 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:54981 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727103AbhAZR2J (ORCPT ); Tue, 26 Jan 2021 12:28:09 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611681999; 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=InZZx23ByJsMJtgt8v5MW2KPKFZSHMum0ATgeWIjqd8=; b=QPAj0sEI+R319997Zm2uGU1TPqp5yidRph4JSPk6URld4d+dF5P0rCfglkkFyCE88+HqJJ p3W8muyb3aalY+7lon+UYDgejAQP03EfRar1E0lHY5LaPKa7yf84zviZa9bHOYmjC+ONa3 eyZmHxpBGIfVphbf3leUcLijQWDczu8= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-247-AAuGIw78NAmXptvnnG9fDg-1; Tue, 26 Jan 2021 12:26:36 -0500 X-MC-Unique: AAuGIw78NAmXptvnnG9fDg-1 Received: by mail-ej1-f69.google.com with SMTP id k3so5192141ejr.16 for ; Tue, 26 Jan 2021 09:26:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:cc:references:from:subject:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=InZZx23ByJsMJtgt8v5MW2KPKFZSHMum0ATgeWIjqd8=; b=ITvbf38322kHt2l5OvXB33MVWEMZUTHxyHIpIyTQijNA/1jydfLKNiXJR7pMuIaqF/ MyCIVEfR4SIrQxvDHO/V0bKquhn/2eWUkWRZDqUYTlyu1d9dJEG+TzAfEYjhCvTw058X A40IiU7sH+52SVluwOAquyRZ2qi+1JmMXv5w+raNKN9J/Y7J/VBpGb5acYOr3Vn+rVgK jJUXx6PIlKmbSPebQ8cmfDuBP/uyNpdAIB8dj/s/b6cX0QTqxXrbcim+WVUG8LnLx4uR fBC0jjzmVcdeog6nyC3egANGM0I3jIbVuUPfIHPg9hjebqMSrqVgSKU1hQ/Bue6NgP9/ 2fvw== X-Gm-Message-State: AOAM532kr1hGlXkyk5MqTMdvAUv2Pr1kOJlRVzwv3MLjMXvCop2T7QeB UY5BBqRquhmoRaRsV3mn3BJBPoiLKgtjDoLuKmA5jpO+swcIGRqkEogrK3jQqvDb9ZW/hzrw+mE LKmioKf07LKJY8K1Yg4tccnnx X-Received: by 2002:a17:906:51d0:: with SMTP id v16mr4206642ejk.510.1611681995781; Tue, 26 Jan 2021 09:26:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgaHAAGGEQ9wEkCKCReCIm094S45eXiZvU1xS2t+W5jQo1GluQUlphaRP+rMn95s2NGrkfUg== X-Received: by 2002:a17:906:51d0:: with SMTP id v16mr4206634ejk.510.1611681995633; Tue, 26 Jan 2021 09:26:35 -0800 (PST) Received: from ?IPv6:2001:b07:6468:f312:c8dd:75d4:99ab:290a? ([2001:b07:6468:f312:c8dd:75d4:99ab:290a]) by smtp.gmail.com with ESMTPSA id k2sm10057634ejp.6.2021.01.26.09.26.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 26 Jan 2021 09:26:34 -0800 (PST) To: Wanpeng Li , LKML , kvm Cc: Sean Christopherson , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , Brijesh Singh References: <1610960877-3110-1-git-send-email-wanpengli@tencent.com> From: Paolo Bonzini Subject: Re: [PATCH v2] KVM: kvmclock: Fix vCPUs > 64 can't be online/hotpluged Message-ID: <146d2a3f-88db-ff80-29d6-de2b22efdf61@redhat.com> Date: Tue, 26 Jan 2021 18:26:33 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/01/21 02:28, Wanpeng Li wrote: > ping, > On Mon, 18 Jan 2021 at 17:08, Wanpeng Li wrote: >> >> From: Wanpeng Li >> >> The per-cpu vsyscall pvclock data pointer assigns either an element of the >> static array hv_clock_boot (#vCPU <= 64) or dynamically allocated memory >> hvclock_mem (vCPU > 64), the dynamically memory will not be allocated if >> kvmclock vsyscall is disabled, this can result in cpu hotpluged fails in >> kvmclock_setup_percpu() which returns -ENOMEM. This patch fixes it by not >> assigning vsyscall pvclock data pointer if kvmclock vdso_clock_mode is not >> VDSO_CLOCKMODE_PVCLOCK. I am sorry, I still cannot figure out this patch. Is hotplug still broken if kvm vsyscall is enabled? Paolo >> Fixes: 6a1cac56f4 ("x86/kvm: Use __bss_decrypted attribute in shared variables") >> Reported-by: Zelin Deng >> Tested-by: Haiwei Li >> Cc: Brijesh Singh >> Cc: stable@vger.kernel.org#v4.19-rc5+ >> Signed-off-by: Wanpeng Li >> --- >> v1 -> v2: >> * add code comments >> >> arch/x86/kernel/kvmclock.c | 6 ++++-- >> 1 file changed, 4 insertions(+), 2 deletions(-) >> >> diff --git a/arch/x86/kernel/kvmclock.c b/arch/x86/kernel/kvmclock.c >> index aa59374..01d4e55c 100644 >> --- a/arch/x86/kernel/kvmclock.c >> +++ b/arch/x86/kernel/kvmclock.c >> @@ -294,9 +294,11 @@ static int kvmclock_setup_percpu(unsigned int cpu) >> /* >> * The per cpu area setup replicates CPU0 data to all cpu >> * pointers. So carefully check. CPU0 has been set up in init >> - * already. >> + * already. Assign vsyscall pvclock data pointer iff kvmclock >> + * vsyscall is enabled. >> */ >> - if (!cpu || (p && p != per_cpu(hv_clock_per_cpu, 0))) >> + if (!cpu || (p && p != per_cpu(hv_clock_per_cpu, 0)) || >> + (kvm_clock.vdso_clock_mode != VDSO_CLOCKMODE_PVCLOCK)) >> return 0; >> >> /* Use the static page for the first CPUs, allocate otherwise */ >> -- >> 2.7.4 >> >