Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5783252rwl; Tue, 4 Apr 2023 03:41:34 -0700 (PDT) X-Google-Smtp-Source: AKy350aBMwUGt5P7ZM8PEBq4SgtUAEbmyGwQN82h+QIRzWJU03teQJOMDZ9FTT3UtG53Nw3SLPFK X-Received: by 2002:a17:907:7dac:b0:932:365a:969a with SMTP id oz44-20020a1709077dac00b00932365a969amr2083264ejc.8.1680604894238; Tue, 04 Apr 2023 03:41:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680604894; cv=none; d=google.com; s=arc-20160816; b=a2V+RwZy5l2Kboerc7n4aDWmVPVFVAHSl7FQB8f2CT5kRJwbnm59I+y42ROMj16pXp /4EAJqQTlgj68b2wYLyBhlEsSjEZD1BLFVoG6gnKyVI7sMYix19pYRs6ArBTiAD1HPv+ zMw0KCFU1MQWpce+sxFaXWsGzzkGg6GOek8saWLhESLmmrLcNBDNWJg74BoTc/VGCbyQ 3PQ+7x4V+o7zAyAdhTHl5br6N+EMxYYX/cVbjfPuxUdxbzNLliunEWEidEYFQw6oSn6W wla78wVgaLgJX57ETPARuVrexl3GFNM3W+/zL6coP/f47ZZXuHpJ9A4xzhkowUAbQejx 5w7g== 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:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-filter; bh=t1RBKOWPXIYWXkmpINOZQASPASeY4H8gbn3HuGOfaXU=; b=svzUjkkSh5o8/Izm4ONd+BMrn78rweu+8fz/ozR8HnI+8prHhCBEhisQ7c2q1ypSGV eXSiCEUppz5G50sY/Pifg0GM2OMQB18Nh+QbnGcwH9lNtS1g8jOOzTafL0jq3F8OteFr EjkSDJhlTy7i08KGo40vqmJTzoEDwCwYLPqN1p0eA4nHsX3X6NHvPVZA1j5dA01l8yRU tPp1B715w77pT31qPh45cHPCsj4kGCWpVUyOK13/nkvJ69tUAdZvHwZT6e2R+OaH/DsH bjKCaQ1Je5qJiWuVZA3xOo4KVJsRR8dOZdYazhx/eoghNBtlMXCrowxuLI3mmnOguOj8 BoUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=C2cXmlNM; 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=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a21-20020a1709063a5500b008b223aa7a2dsi607009ejf.734.2023.04.04.03.41.10; Tue, 04 Apr 2023 03:41:34 -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=@linux.microsoft.com header.s=default header.b=C2cXmlNM; 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=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234426AbjDDKjX (ORCPT + 99 others); Tue, 4 Apr 2023 06:39:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234440AbjDDKjV (ORCPT ); Tue, 4 Apr 2023 06:39:21 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 642DF198A; Tue, 4 Apr 2023 03:39:17 -0700 (PDT) Received: from [10.156.156.87] (unknown [167.220.238.23]) by linux.microsoft.com (Postfix) with ESMTPSA id C114E210DD83; Tue, 4 Apr 2023 03:39:14 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C114E210DD83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1680604756; bh=t1RBKOWPXIYWXkmpINOZQASPASeY4H8gbn3HuGOfaXU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=C2cXmlNMbgJtDztc5Z5+q05aQErSSQ+TITzEQjzFT85RztAMThbd76GivmwzcMhKT xP5j40JNpbGjq5g/hNzGzH2MhACUsvN/4pAwoZd2u+Dq31G52HRiZRSS8+eK1ZzNjD H7MZIdoAhofhLEhFUfKfa2hbF9jQZcLc74/eAxi0= Message-ID: <03f62671-7f01-eeb3-4326-cbf0c2250c30@linux.microsoft.com> Date: Tue, 4 Apr 2023 16:09:12 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 Subject: Re: [PATCH] Drivers: hv: Do not free synic pages when they were not allocated To: Nuno Das Neves , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org Cc: mikelley@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, haiyangz@microsoft.com, decui@microsoft.com References: <1680564122-30819-1-git-send-email-nunodasneves@linux.microsoft.com> Content-Language: en-US From: Jinank Jain In-Reply-To: <1680564122-30819-1-git-send-email-nunodasneves@linux.microsoft.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-19.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,NICE_REPLY_A,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable 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 Reviewed-by: Jinank Jain On 4/4/2023 4:52 AM, Nuno Das Neves wrote: > In case of root partition or snp, the synic pages are allocated by the > hypervisor instead of the kernel, so they should not be freed. > > Signed-off-by: Nuno Das Neves > --- > drivers/hv/hv.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c > index c7f7652932ca..a10cf642c9ad 100644 > --- a/drivers/hv/hv.c > +++ b/drivers/hv/hv.c > @@ -193,8 +193,10 @@ void hv_synic_free(void) > struct hv_per_cpu_context *hv_cpu > = per_cpu_ptr(hv_context.cpu_context, cpu); > > - free_page((unsigned long)hv_cpu->synic_event_page); > - free_page((unsigned long)hv_cpu->synic_message_page); > + if (!hv_isolation_type_snp() && !hv_root_partition) { > + free_page((unsigned long)hv_cpu->synic_event_page); > + free_page((unsigned long)hv_cpu->synic_message_page); > + } > free_page((unsigned long)hv_cpu->post_msg_page); > } >