From patchwork Thu Oct 6 03:11:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 612851 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp1193898pvb; Wed, 5 Oct 2022 20:23:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7P+TGlNLk4rqQzxd4KH4REG6OpPMORYBLIU8Z1zjciEf0ohpxE61ZgJksSET4TETWBjkr1 X-Received: by 2002:a05:620a:148:b0:6e4:5d13:7d2a with SMTP id e8-20020a05620a014800b006e45d137d2amr1867602qkn.259.1665026611307; Wed, 05 Oct 2022 20:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665026611; cv=none; d=google.com; s=arc-20160816; b=hotdFvaXN5I3g5QyvbYS91wvyUUunu+rysYiuh5DXCrGj9gnpi8ekcoM7PBvVkgk4q uSUa2GUcQG1gNUcyPNxkXeDDv/WW5s8zrPNyWmGWNGewMYK7sc4UvACrMZ7iV+YsEhUh Jw/ui5mz74Y9HEqrUMK3xHK2Jy1625A+fTv4AW2bl/JWqWl9gcP0uJmPdCIxxem0jVGr YCqosl0wBFFSTqHO71Bfz5WfI/NOKPMFxjtQqXu5kXxNFaFDUpCgce6xG2pS3CPESjeS wNf8UQa/HGj+DZk5Jk4gCr87+hBP/zG/4FQrtW0tPuUb529IfKhmHr9u+AjfPYUCHJai jKBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to: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:cc:to :from:dkim-signature; bh=I02Pd3AEii+oy/pB87AZKJX0kpqM/XYrou+bQ1J7ZKA=; b=rjrbjAHWdyGTQEbnFtE9SeGR4SUUoS/bIpouJhyILNoVaVlfVhIn5cYg+C/UCYUya4 zR4SOujmZbLVDbj6zguCG3Da1y2kVJnn+fJeJ21PaW3JDS2WXQlqt1c9Dq/OEe6W2fq2 0/9eTwRCAav9omZyxM+FJzbpOnqrKwDQvAaoPZD5FQF132IRww956iU+eiPXsjsm/xhD zylVfqBvOBVDJTml/taseE/ovzEl0BpdQzx9Q3uZ3M09HH3ARfoK5C4hR5yHaUBGV9TF CxxcfpDI1Dg4QxRarnyHmN/aV4XJqLKHlWIFiyZM1jMZjX03j3lhzd8LYGYjfuOe5rsc xSXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="ShEDNP/T"; 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=pass (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 y13-20020ac8524d000000b0031f0afeb4d5si6535094qtn.666.2022.10.05.20.23.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Oct 2022 20:23:31 -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=pass header.i=@linaro.org header.s=google header.b="ShEDNP/T"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44284 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogHTu-00069d-SL for patch@linaro.org; Wed, 05 Oct 2022 23:23:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42012) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogHIQ-0005zQ-QC for qemu-devel@nongnu.org; Wed, 05 Oct 2022 23:11:38 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:43774) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogHIP-0006w3-7y for qemu-devel@nongnu.org; Wed, 05 Oct 2022 23:11:38 -0400 Received: by mail-pf1-x436.google.com with SMTP id 204so841484pfx.10 for ; Wed, 05 Oct 2022 20:11:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=I02Pd3AEii+oy/pB87AZKJX0kpqM/XYrou+bQ1J7ZKA=; b=ShEDNP/Tg7hniRioTAVxFalPZBS1odnhA4sP3ndXdU6VCp+6cIx0MpQ7X9dBk+uoSz F03MzA0LX3H1HB+6ii1NHDunNtLgI1Swmn7jzqysXmyMi4tv+VrHzUnCMRpD9sLWlpQ2 Yd5ItN0FsDNUR81LJKII8vjUBpSGv8cb74dVko6xIilT5riH8cxyTHOmvJ+/IvkEAyse MGK0VwnxtjD4D899Q15u0cdohy/GQzHWiaT4HUr7wcGiRspxT27O0UmkXE73KbMU3+Lu udlbeCQQs1l7tX0Bv3DEo7M+rZKXLlqSHlGbbDqeBoa+PZCSIyr9hrHD9ROcgdfixHgD wzBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=I02Pd3AEii+oy/pB87AZKJX0kpqM/XYrou+bQ1J7ZKA=; b=ZoAZBTOlSSnDPZM7ChIfCO/uYPKcZ1e8Ll3ozfU5KKvC9HnO6GHPuV4XiRFJvcwK3H 0BtaFBO07FMvQ+ZWpsIKwt6bj5hyb8/9OBFDac5BF3u1uu/vugediKXthpPjeelcxZVo w/r5CXnrlC/27Jt8iSXwBxVqXlnaK9mOYpbaTX36yOgnNwD2+bzGY+ZpL4buuVCgfXht KoatImyd2d0wTsKb+0MqVTjBuSOo+AKI2LGhtENyKRFkNgTK5tYS3XbxZ06s1natjmc8 tR41qFpnipOX5UerH/fgb6AFvCgb8eBH7QSN67kAebbwBjVID0aj+yqY1TosLoYXb6Qk /9AA== X-Gm-Message-State: ACrzQf1oSRVJXU+sVkcyQBGNxhyYxiQRRQrDEShXWGyss6KgVNzVieiQ LzzSdjEzaYVtWbR6OfyrY4sy3nQBf3SBMg== X-Received: by 2002:a65:6cc4:0:b0:412:35fa:5bce with SMTP id g4-20020a656cc4000000b0041235fa5bcemr2516477pgw.466.1665025896472; Wed, 05 Oct 2022 20:11:36 -0700 (PDT) Received: from stoup.. ([2602:47:d49d:ec01:9ad0:4307:7d39:bb61]) by smtp.gmail.com with ESMTPSA id u128-20020a627986000000b0056281da3bcbsm58360pfc.149.2022.10.05.20.11.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 20:11:35 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: alex.bennee@linaro.org, laurent@vivier.eu, pbonzini@redhat.com, imp@bsdimp.com, f4bug@amsat.org Subject: [PATCH 17/24] accel/tcg: Use tb_invalidate_phys_range in page_set_flags Date: Wed, 5 Oct 2022 20:11:06 -0700 Message-Id: <20221006031113.1139454-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221006031113.1139454-1-richard.henderson@linaro.org> References: <20221006031113.1139454-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Flush translation blocks in bulk, rather than page-by-page. Signed-off-by: Richard Henderson Reviewed-by: Alex Bennée --- accel/tcg/translate-all.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 0006290694..04401ceac7 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1352,7 +1352,7 @@ int page_get_flags(target_ulong address) void page_set_flags(target_ulong start, target_ulong end, int flags) { target_ulong addr, len; - bool reset; + bool reset, inval_tb = false; /* This function should never be called with addresses outside the guest address space. If this assert fires, it probably indicates @@ -1388,11 +1388,15 @@ void page_set_flags(target_ulong start, target_ulong end, int flags) && (reset || !(flags & PAGE_EXEC) || (flags & ~p->flags & PAGE_WRITE))) { - tb_invalidate_phys_page(addr); + inval_tb = true; } /* Using mprotect on a page does not change sticky bits. */ p->flags = (reset ? 0 : p->flags & PAGE_STICKY) | flags; } + + if (inval_tb) { + tb_invalidate_phys_range(start, end); + } } void page_reset_target_data(target_ulong start, target_ulong end)