From patchwork Fri Jun 11 23:41:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 458777 Delivered-To: patch@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp1379064jae; Fri, 11 Jun 2021 17:05:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxk9KP3v5EO0taoCTrPCMo7x8A1hro/sWK9ML3eMSUHW0ah0Sh0uu+5U2QrG7jzMA+yfG/R X-Received: by 2002:a5d:4610:: with SMTP id t16mr6205237wrq.324.1623456309447; Fri, 11 Jun 2021 17:05:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623456309; cv=none; d=google.com; s=arc-20160816; b=cB+nVwEB+nRe1fJqGMXoESDrSpVubGc4C+b4k5cwRTZFsYPxCm+NOdpJBNJqOnMfB+ JBU1Dtawc3UAfLNh3p5MqEO6eRnuC/pylPo4ptea7Yy60IZohCs8cuntB+l8k+mg9U74 cteaB0ZiBUZmbG8jagea2fIO+2bvLkJyme+eQrXUe+Z8lxL24S4+DxKQQyaVgRuMxIRP N5kBnFoRBE0Hb9thZPiCgi6SuqD73/FW5c8+DgmyUGGoMmAS3D23jfLpnphZHR4Xl74H v9pn5+KfVSQPH23UB4zK0QJMs9sgSQXX7Sgn8aNsBiNvY8znPfD7pMi+yWR01LlJhZ54 IZnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=oGlm/QkFrT3k7s3B4Mdy2N+YuMxL0+85EjDFAhTeOqA=; b=1ImuEu253cy28jH0DPJYYoX5MI8IEp5z/EMsv+MNAIdCs1wagcxY4YVyrgkZGLkKoc VIJlvAbVKTaY9OdVKH5cCgST4jMZLlZxhiY903TM2ojqKIuo+yJn63tH1KiczQqoo9vv x697sRL1Jedyj3+43svNpt2j1sqgC/UoNR1CsRCiWXwD/6ClUNNHXDW+eqY4KETpauip zcBWStNv74QhNhXuxUmhb4Xc29tvP6YKpv0Bx7rCfw1TE/GeK16i1gi2QLjnDY5nFN6Z fqp9GqPWLexQlX758S1c8o3orCjyxYGzxnmG1hVDYWk/lItsP3poozD5xxsFJUgB54R3 3igQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Ec6x/vq2"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g12si8268389wrd.272.2021.06.11.17.05.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 Jun 2021 17:05:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b="Ec6x/vq2"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:58236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lrr9A-0005KY-7P for patch@linaro.org; Fri, 11 Jun 2021 20:05:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47330) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lrqmp-0002xd-R0 for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:42:03 -0400 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]:45589) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lrqmn-0002ji-81 for qemu-devel@nongnu.org; Fri, 11 Jun 2021 19:42:03 -0400 Received: by mail-pj1-x1031.google.com with SMTP id z3-20020a17090a3983b029016bc232e40bso6852360pjb.4 for ; Fri, 11 Jun 2021 16:42:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oGlm/QkFrT3k7s3B4Mdy2N+YuMxL0+85EjDFAhTeOqA=; b=Ec6x/vq2wkKpCa2bzY9c0MUR1Jgjz6JvfO5KTP/n+Fg0psi2PzlBpXcPINJx+Wfzj+ aGnhrzRyDEgswHNGnP/kq6FowPybs8rCbaBKAg7m8Wt4SFNl8nzoVlqn/s6Sof7LIBdW Co5Jmu1c9wUlAgTqIh/akT8OUrR8ycRTDx6t5MPfKs9UIQoq/p1ZrXF6QvkCoGzle33w DP9GsKCT9lHn2W0ex39gup8tEmxRoq1zM1Ce3ODlXhv5UxS276+GHvfe5V1Kphu+YGvj OSl/d4CzGGVB7fETBSTf/U0pdcBaA6IxNQqeC0yOQjuF0aSaN7yoq8odrDMQmBDcG6pu iPxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=oGlm/QkFrT3k7s3B4Mdy2N+YuMxL0+85EjDFAhTeOqA=; b=giz0DK6xulNqt5XN5tL8v0HVx4faodv7wGCLDRShyTLoExFS3JXmdqVBQgBCZV0jET eYa0UN3ZPy2I0EJasgu5DTY0NW68sXaSMbB8MuffOFejCbTSlxgg2PL/GlM4oa3D+gJF qHepn5tnlxWq2YoQoVheV4H88or73ApZn+lHQetFNc4JY98g/W/lwv451Fqjy2Cdqu1Y sb8EuCwfhn79yYBil66tSBUStakW95+SpJCEq7MrjHw8Mb/0PdDkIVWhFwf7Zcck7sgJ TxbKAKqA6+5V5jt6Upj1T5DsUIPqP7lSNOWc8wfK2LDyxaWdluBsXK0ivnP5L0vP2JD6 cXWA== X-Gm-Message-State: AOAM531MyKS5OcBYV2l9BEVFZXnlkk9CJPDHbeY/2BjW/TT/tFu9Fi+J bi5OSmITQ/DU4thCGp+r9lwmk8Oc2qwmzg== X-Received: by 2002:a17:90a:4404:: with SMTP id s4mr11544556pjg.218.1623454920007; Fri, 11 Jun 2021 16:42:00 -0700 (PDT) Received: from localhost.localdomain (174-21-70-228.tukw.qwest.net. [174.21.70.228]) by smtp.gmail.com with ESMTPSA id q23sm6139829pgm.31.2021.06.11.16.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Jun 2021 16:41:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL 24/34] tcg: Sink qemu_madvise call to common code Date: Fri, 11 Jun 2021 16:41:34 -0700 Message-Id: <20210611234144.653682-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210611234144.653682-1-richard.henderson@linaro.org> References: <20210611234144.653682-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1031.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Luis Pires , =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Move the call out of the N versions of alloc_code_gen_buffer and into tcg_region_init. Reviewed-by: Alex Bennée Reviewed-by: Luis Pires Signed-off-by: Richard Henderson --- tcg/region.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) -- 2.25.1 diff --git a/tcg/region.c b/tcg/region.c index e6c80b35b1..2e541cd2bf 100644 --- a/tcg/region.c +++ b/tcg/region.c @@ -559,7 +559,6 @@ static int alloc_code_gen_buffer(size_t tb_size, int splitwx, Error **errp) error_setg_errno(errp, errno, "mprotect of jit buffer"); return false; } - qemu_madvise(buf, size, QEMU_MADV_HUGEPAGE); region.start_aligned = buf; region.total_size = size; @@ -635,9 +634,6 @@ static int alloc_code_gen_buffer_anon(size_t size, int prot, } #endif - /* Request large pages for the buffer. */ - qemu_madvise(buf, size, QEMU_MADV_HUGEPAGE); - region.start_aligned = buf; region.total_size = size; return prot; @@ -687,9 +683,6 @@ static bool alloc_code_gen_buffer_splitwx_memfd(size_t size, Error **errp) region.total_size = size; tcg_splitwx_diff = buf_rx - buf_rw; - /* Request large pages for the buffer and the splitwx. */ - qemu_madvise(buf_rw, size, QEMU_MADV_HUGEPAGE); - qemu_madvise(buf_rx, size, QEMU_MADV_HUGEPAGE); return PROT_READ | PROT_WRITE; fail_rx: @@ -857,6 +850,13 @@ void tcg_region_init(size_t tb_size, int splitwx, unsigned max_cpus) splitwx, &error_fatal); assert(have_prot >= 0); + /* Request large pages for the buffer and the splitwx. */ + qemu_madvise(region.start_aligned, region.total_size, QEMU_MADV_HUGEPAGE); + if (tcg_splitwx_diff) { + qemu_madvise(region.start_aligned + tcg_splitwx_diff, + region.total_size, QEMU_MADV_HUGEPAGE); + } + /* * Make region_size a multiple of page_size, using aligned as the start. * As a result of this we might end up with a few extra pages at the end of