From patchwork Mon Jul 17 10:22:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 13315389 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 172ABEB64DC for ; Mon, 17 Jul 2023 10:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231164AbjGQKXH (ORCPT ); Mon, 17 Jul 2023 06:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231156AbjGQKXF (ORCPT ); Mon, 17 Jul 2023 06:23:05 -0400 Received: from mail-wr1-x44a.google.com (mail-wr1-x44a.google.com [IPv6:2a00:1450:4864:20::44a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 03FB5E52 for ; Mon, 17 Jul 2023 03:23:04 -0700 (PDT) Received: by mail-wr1-x44a.google.com with SMTP id ffacd0b85a97d-30e6153f0eeso2354605f8f.0 for ; Mon, 17 Jul 2023 03:23:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1689589382; x=1692181382; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=CgCaN+mGckAFfG7mTYRYDoN94M9ScWInFeoK4EY52dQ=; b=eeI7fj4MJRXbFVCcu9v33JfJB7bbN34zs7DBgQjkHRepXBoCTI7B+CiFKUVl+sj90C MX+VzfdsfESuNdT2ApiRvndM7sQeYPuBf4IR9F2zg/ziZjnUWGf5yfXJL7FSWXhVvQk2 k+7zDts2v+zuz6Sxdwq7INj16h7ayIIQHqp1A03cR71q6RRR1Sp9KGRw9fT51LAUsODs u6iwgaeSercqwi4jFOe2GgLG05AvcnEfOa+4gKWJ+EcAX/AbkRAsFaxErP6x7YDtancg LAZFThRtBGlhYyiWCKkWs2tjI4Km/Sz28X6WqywueBNeNLpaZn0hERd+a6xbillOeV4U vICA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689589382; x=1692181382; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=CgCaN+mGckAFfG7mTYRYDoN94M9ScWInFeoK4EY52dQ=; b=kUrN1gL12XmHCh22L7k0jSVasucVHccSWIW/Yl0r6LYi8St9a5g3VZkVdBhJPFAF1E B1+bJVN2ZRNhz/y24lTudgqdUaHlK4EAPUQsBnWUahRPDNOg/V+oHAZ7iLgTgZErDin2 1lKZ+IDgT3nhUzDKsw4WTDex5JNbZp5OVFKeZAZTx3+QhaT2MXgylO5aM5tNDUtXkCBl JBXGKFFCeHOjxUa+5+GqV77Z4N8UZLG7Ao4AU9cC3W8AzjTFCWlKOztZLTap655DdNgy 8FXcdmasjpnP6kTCmpA8Trg2a9Q6gbxOUB7abGvvMvbWjQ/Lggc/+cy22fu+zKbcf5qU APxQ== X-Gm-Message-State: ABy/qLa91FAPJr3t0opOiRFM+KRU8XtEWdbz4ENHEOg5JtfhDOAXTyub R7YZRD+J78WPtpcyvp/W013jC0Nkq1pnJ+8OBWNKHYLXlFDpLMl8fBdS2dbUlQybY9gw+Q/RqWT yqhqnPm+axN5U9bijrhW7UyBZyCNnLj3uzzZuhxhiy0ATv757PSgPnNo= X-Google-Smtp-Source: APBJJlE/7e1nJg7I/l6LQXVY0SnzM8P70EbYcwya86Mruz3AmAkrLrw/c0iAlFyYa4bUxuD5Xsvq8/X2iw== X-Received: from fuad.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:1613]) (user=tabba job=sendgmr) by 2002:a5d:6d4b:0:b0:314:38e4:259d with SMTP id k11-20020a5d6d4b000000b0031438e4259dmr83620wri.11.1689589382378; Mon, 17 Jul 2023 03:23:02 -0700 (PDT) Date: Mon, 17 Jul 2023 11:22:58 +0100 Mime-Version: 1.0 X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230717102300.3092062-1-tabba@google.com> Subject: [PATCH kvmtool v1 0/2] Align value generated by get_ram_size() to the host's page size From: Fuad Tabba To: kvm@vger.kernel.org Cc: julien.thierry.kdev@gmail.com, will@kernel.org, penberg@kernel.org, alexandru.elisei@arm.com, tabba@google.com Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi, This short patch series ensures that the value returned by get_ram_size() is aligned to the host's page size. Without that, KVM_SET_USER_MEMORY_REGION could fail when passed an unaligned value. Cheers, /fuad Fixes: 18bd8c3bd2a7 ("kvm tools: Don't use all of host RAM for guests by default") Signed-off-by: Fuad Tabba Fuad Tabba (2): Factor out getting the host page size Align the calculated guest ram size to the host's page size builtin-run.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) base-commit: bd4ba57156dad39349edfb2338bdc2f4ed3c0bae