From patchwork Tue Apr 26 19:00:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 1622631 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=tsVHZ6ii; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4KnrnF2NMxz9s3q for ; Wed, 27 Apr 2022 05:00:49 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1njQQW-0002nb-6n; Tue, 26 Apr 2022 19:00:44 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1njQQR-0002iC-22 for kernel-team@lists.ubuntu.com; Tue, 26 Apr 2022 19:00:39 +0000 Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 6FAA23F1E3 for ; Tue, 26 Apr 2022 19:00:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1650999638; bh=dphGk4w0LHLqPNO5NIyXwsmbmyTaLsGnwhr3AipfYK0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=tsVHZ6iiktQ+gVPkdSdexLPwtovDqXBR/aDcms96XQKTw7KqONdGWA8b6f6Va/vtj 0KRC9RtmR2Y0PIJu0QkalzYfZpq3UDBhNZTWQ4pSQoljSDk5m1feS4DoJSDOqy2o88 HPuKP6hHoZlTiBQiclhWuyvTzjYYD4obiNlGVFLjI7Wuo//kU/Iv9XBXHcEl0ITKM6 xyjMdetc2y2Tvc4J/pbvwrOCakRru6EAsRkAYuqzlE74gq1Z0XOFXGguG3MT2ujQ8J UCuKmmRRVx0VwtzzfRwc8FZNtrq83klORMgJeg/xC0URgtd5JvFbrQvHm7NRNTs/d7 /IqWYnFgrRkKA== Received: by mail-pj1-f70.google.com with SMTP id w3-20020a17090ac98300b001b8b914e91aso1572977pjt.0 for ; Tue, 26 Apr 2022 12:00:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dphGk4w0LHLqPNO5NIyXwsmbmyTaLsGnwhr3AipfYK0=; b=yMu7REUoW5xbdNTaye0sIUkM1CX5D/tRMxfZdy5AM+iTbHrvyMZ/Weor7E7yCDq55c fUQasK6TtINrA7tyhc6+YNdINuDfgKKARDG5fYphzSGC/asBlWDqJEIUeYHfTMy1e0Na ay6Ciz3pUtqYbKDQ8JzuHPwejwMs3TeIQWFVBkgv+IBsQH+viMg+C+BmCOGjr4bBITOF 4pPCKK5D04HKkLgYmvZAjv34buqlOelOyVpb8pEp2f2iieyFWgONCVnGoywFKb2/R3GS bQG2C+1jTVbV86RQ/jp8sg5sGp1z5yUFJdlSrjEwBMfNxSwa6ozwnYtKhj5/16t2JJhn cQaw== X-Gm-Message-State: AOAM533tcdzlcFcF22BbDr09kYZOv9SBPv5AAIEAagMc3GzcrxvMdza2 fGBgS2oF73vIdZgsJ4vB3xu3qpPMRnfvlfPr2P2tJibGj30Q40qbLK+g28T9o94aq9JalYjCYlu 1W1AS0undgq80zriVwc5djX7ymAAvfBPdriFsSPSYkw== X-Received: by 2002:a17:902:bcc1:b0:158:f806:4287 with SMTP id o1-20020a170902bcc100b00158f8064287mr24650362pls.138.1650999636194; Tue, 26 Apr 2022 12:00:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiXb4NKKdvcKjR+EI/R4/dbvqBOuY+2zLpo/SQgEZwbCvHIktbwMhZeILJJi62iJDdCe1YXQ== X-Received: by 2002:a17:902:bcc1:b0:158:f806:4287 with SMTP id o1-20020a170902bcc100b00158f8064287mr24650334pls.138.1650999635807; Tue, 26 Apr 2022 12:00:35 -0700 (PDT) Received: from localhost.localdomain ([69.163.84.166]) by smtp.gmail.com with ESMTPSA id n12-20020a63e04c000000b003aa7a100827sm13280229pgj.10.2022.04.26.12.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Apr 2022 12:00:35 -0700 (PDT) From: Tim Gardner To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/3] Drivers: hv: balloon: Disable balloon and hot-add accordingly Date: Tue, 26 Apr 2022 13:00:30 -0600 Message-Id: <20220426190030.13586-4-tim.gardner@canonical.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220426190030.13586-1-tim.gardner@canonical.com> References: <20220426190030.13586-1-tim.gardner@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Boqun Feng BugLink: https://bugs.launchpad.net/bugs/1970468 Currently there are known potential issues for balloon and hot-add on ARM64: * Unballoon requests from Hyper-V should only unballoon ranges that are guest page size aligned, otherwise guests cannot handle because it's impossible to partially free a page. This is a problem when guest page size > 4096 bytes. * Memory hot-add requests from Hyper-V should provide the NUMA node id of the added ranges or ARM64 should have a functional memory_add_physaddr_to_nid(), otherwise the node id is missing for add_memory(). These issues require discussions on design and implementation. In the meanwhile, post_status() is working and essential to guest monitoring. Therefore instead of disabling the entire hv_balloon driver, the ballooning (when page size > 4096 bytes) and hot-add are disabled accordingly for now. Once the issues are fixed, they can be re-enable in these cases. Signed-off-by: Boqun Feng Reviewed-by: Michael Kelley Link: https://lore.kernel.org/r/20220325023212.1570049-3-boqun.feng@gmail.com Signed-off-by: Wei Liu (cherry picked from commit be5802795cf8d0b881745fa9ba7790293b382280) Signed-off-by: Tim Gardner --- drivers/hv/hv_balloon.c | 36 ++++++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 062156b88a87..eee7402cfc02 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -1660,6 +1660,38 @@ static void disable_page_reporting(void) } } +static int ballooning_enabled(void) +{ + /* + * Disable ballooning if the page size is not 4k (HV_HYP_PAGE_SIZE), + * since currently it's unclear to us whether an unballoon request can + * make sure all page ranges are guest page size aligned. + */ + if (PAGE_SIZE != HV_HYP_PAGE_SIZE) { + pr_info("Ballooning disabled because page size is not 4096 bytes\n"); + return 0; + } + + return 1; +} + +static int hot_add_enabled(void) +{ + /* + * Disable hot add on ARM64, because we currently rely on + * memory_add_physaddr_to_nid() to get a node id of a hot add range, + * however ARM64's memory_add_physaddr_to_nid() always return 0 and + * DM_MEM_HOT_ADD_REQUEST doesn't have the NUMA node information for + * add_memory(). + */ + if (IS_ENABLED(CONFIG_ARM64)) { + pr_info("Memory hot add disabled on ARM64\n"); + return 0; + } + + return 1; +} + static int balloon_connect_vsp(struct hv_device *dev) { struct dm_version_request version_req; @@ -1731,8 +1763,8 @@ static int balloon_connect_vsp(struct hv_device *dev) * currently still requires the bits to be set, so we have to add code * to fail the host's hot-add and balloon up/down requests, if any. */ - cap_msg.caps.cap_bits.balloon = 1; - cap_msg.caps.cap_bits.hot_add = 1; + cap_msg.caps.cap_bits.balloon = ballooning_enabled(); + cap_msg.caps.cap_bits.hot_add = hot_add_enabled(); /* * Specify our alignment requirements as it relates