From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04D47C433ED for ; Sun, 2 May 2021 23:32:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 99E136112F for ; Sun, 2 May 2021 23:32:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 99E136112F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46782 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ldLZK-0001Ea-Gr for qemu-devel@archiver.kernel.org; Sun, 02 May 2021 19:32:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37168) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ldLMm-0008NY-7F for qemu-devel@nongnu.org; Sun, 02 May 2021 19:19:12 -0400 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]:43810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ldLMg-0002z7-88 for qemu-devel@nongnu.org; Sun, 02 May 2021 19:19:11 -0400 Received: by mail-pj1-x1032.google.com with SMTP id cl24-20020a17090af698b0290157efd14899so880848pjb.2 for ; Sun, 02 May 2021 16:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=Y1Xrc8fP8CZ6dZ7PAmDVWqhq2c76R5A8I5Dx2N52iow=; b=cnsPRLgY4Qjco9aukxY9euKEi5w8zIu27OnA5hyAFbpUgh3jprqo34x5gztZOrYkGH etLk47rPNcDnBZCmlurz1c37v2YzfpCR604IERWdRQTQeF2MHASEHVKPj/hiTGLWtl4L waTVVBQ3FyN7d4wV6KPQfH0WjUJPj8YcZO12aaScfQ7eLZLcQvSvGkGfwl5anwacFVwX 2pq9rYrBpxgCDA+rM8b3h7cYt+s7umDOHZQjvs2YCW6Ilhg59E1DH8mSDNAlm9R4YGzx sJTqAAch23eRg+Djr6W+mM+kVT79OFjuQTCfOYIl+rhaTb6Dn6MGLa3M5e8hrpQrY+6a Wwwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Y1Xrc8fP8CZ6dZ7PAmDVWqhq2c76R5A8I5Dx2N52iow=; b=VDinwh4R78RkNnze/Dr0bDB+Efr4h1aoG/4wdMfFBOeudqxHRrdE5GXR2IML0zTPOU t2Av6cddHvy+oE02iNHGPYzw2CvOKg5o6xam2VOyE9rcZ8v4JN1a0hZIjQ46GF4vClJ/ 7Cc3cTEHUOsSzVMGufDVu3ABFGA4LcO6C+KA0t8YqzGo4LNVFHOJLv7qkEZj+99M92q/ d4FJFZpPlNSKbKe2yNMuweYpdxp2cnmA6PKUcIND896J13axZpChX8nt1wSRWBL/O0uj rWIyVU4c6WjcxjvEk9Nhq3TBgQoPF8HuXzPjFuLHl+r/oeoQAjpG5v3+VfWSwjQFqpOB TZ5Q== X-Gm-Message-State: AOAM530lG5LYSY/1DpwB7lcCrT21ZKqAROyKHFgQXc36N77ACBTkP7v8 u7D8cACZXyUQImjtkGeEsekjrNjoMJkNGQ== X-Google-Smtp-Source: ABdhPJzPXw5QyzOgkWS4er0ARMaYJSok/3xlpLI1PgIvNiuK9j+/E4DVpJ0PbrYJctvWYpK9Bq4GUQ== X-Received: by 2002:a17:90b:46c4:: with SMTP id jx4mr13700186pjb.155.1619997543356; Sun, 02 May 2021 16:19:03 -0700 (PDT) Received: from localhost.localdomain ([71.212.144.24]) by smtp.gmail.com with ESMTPSA id k17sm7146236pfa.68.2021.05.02.16.19.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 May 2021 16:19:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PATCH v3 23/28] tcg: Sink qemu_madvise call to common code Date: Sun, 2 May 2021 16:18:39 -0700 Message-Id: <20210502231844.1977630-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210502231844.1977630-1-richard.henderson@linaro.org> References: <20210502231844.1977630-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::1032; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1032.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: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Move the call out of the N versions of alloc_code_gen_buffer and into tcg_region_init. Signed-off-by: Richard Henderson --- tcg/region.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tcg/region.c b/tcg/region.c index 23fe113750..b3f0b9bda5 100644 --- a/tcg/region.c +++ b/tcg/region.c @@ -554,7 +554,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; @@ -630,9 +629,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; @@ -682,9 +678,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: @@ -852,6 +845,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 -- 2.25.1