Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp5219697rwl; Mon, 3 Apr 2023 16:40:47 -0700 (PDT) X-Google-Smtp-Source: AKy350YCkfd+h9gQcsirYzbjFnONQ1vTVPt8mfoH7/We4ddflZRI5vPkr63R4tjem3UD5yvuObTa X-Received: by 2002:a05:6402:1a46:b0:502:4d8c:c836 with SMTP id bf6-20020a0564021a4600b005024d8cc836mr856111edb.10.1680565247434; Mon, 03 Apr 2023 16:40:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680565247; cv=none; d=google.com; s=arc-20160816; b=WS4OpgXtNFjOPzWKngTiZpHD7qzdd9D/So6QRxl2P7ghN9EpnLDPMpURFh/X478hi1 DNETkDjgU9YpY5n/dhtJ7eSPMQ5CZAzDkoAXb2WDdnKjLe9gFdyr9vwxxOS1r7sFGrB+ IRmCIDHWU2bumfbKjmad5L/FAEX/csbYXVf2rM4xaWiriU0NDohYzFgafC5iPMKhJ5SM M5bnIb5IDxacvN06X0Zza2br6XngO1IMZ9eOkjm/r4rwDEVpaBkXkVd2XvJujzJcS3oJ oCQVzrgK+y4xgCCbMoJ3nAe1N6A1KRIaLBmPEEdF8XHHX8Q84uGHn08I1PWXcWp6eKPv ntMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=MC+jadVc7FZbGi+PwmB9b0t3If3HuxEogBotcxti98I=; b=Pa7wo2WxVWjBpxF+Zi4+VuwIfh7IThBosQbW1zG2uyaYa+iUMGCD0cz3+VsvW0SqsN uRJhaOmVz7bx8efFnDS0OMSSrIFgGg9ZHwNKp+djoy1MpGwn+/grPKkPHDOwws1Syi20 sSe40D23Bq3eNJGLeK0lVxAAjgvWEL62RrJTMcN+UHQTld+CCBrGt88w6SNmkzM2gK2t 3lM41EOHbOQJ/p1iiiHtM8+HnaI8pIngyB7mJ24Tzmve1HP6uwcKxwudBZrJU5apDS/n RfNo4Z9T3pblOIj1Ecucpt4bqgHGgTMljWm0vimFoIXYr46PA20mDFf3eAv+M0fW2JOt TAsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=X46iBUYG; 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 q10-20020aa7da8a000000b00501df8f316bsi5965950eds.308.2023.04.03.16.40.22; Mon, 03 Apr 2023 16:40:47 -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=X46iBUYG; 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 S233866AbjDCXWU (ORCPT + 99 others); Mon, 3 Apr 2023 19:22:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233284AbjDCXWT (ORCPT ); Mon, 3 Apr 2023 19:22:19 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E5889211F; Mon, 3 Apr 2023 16:22:18 -0700 (PDT) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id 6A784210CBF2; Mon, 3 Apr 2023 16:22:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6A784210CBF2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1680564138; bh=MC+jadVc7FZbGi+PwmB9b0t3If3HuxEogBotcxti98I=; h=From:To:Cc:Subject:Date:From; b=X46iBUYGR8gEtSk2jXJFF/MeQphJna/uVGxpdfPl5XYIAR4pTYTc84kVOd+hdx3XR nS2se5fOGKUeQuy4BHNYxTtIXjN4TIfXpA/jyd1U/u9dJQ665wqHZq33vv+0PfPoc0 jftKOfk+FSmfnZl7TZEafLjzQ91RTAy09UYjrisU= From: Nuno Das Neves To: 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 Subject: [PATCH] Drivers: hv: Do not free synic pages when they were not allocated Date: Mon, 3 Apr 2023 16:22:02 -0700 Message-Id: <1680564122-30819-1-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-17.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,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 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); } -- 2.25.1