From patchwork Fri Dec 9 09:36:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= X-Patchwork-Id: 632246 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp738579pvb; Fri, 9 Dec 2022 01:37:53 -0800 (PST) X-Google-Smtp-Source: AA0mqf4fYAJ60dptj4nuMRQ6fW7ZEaX96fe9oYNKjBfDfoy6SJ4OlbD28jZPt3QIT7fcCIq0Pj8F X-Received: by 2002:ac8:1194:0:b0:3a5:c6ad:7cd7 with SMTP id d20-20020ac81194000000b003a5c6ad7cd7mr7195848qtj.24.1670578672970; Fri, 09 Dec 2022 01:37:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670578672; cv=none; d=google.com; s=arc-20160816; b=CgE8wiAock/hWVXXl6anEejtD/uvzW9RKGGPaW+zVGF7GyFvyepoqe3AckFkMzgc/B 5tXXTYS7yWcVQEDFFlL3404vsNklPKEfAb4JxbQmlLYp+rN5iIJvQ2WhzLP1JjbVjQ6X uBDFjNdD4M6WgYSuNaYMM4b11oX6XLscgVbd8dLbLeZ9TqNyhKAl0+vo3fq6FFSxOkGH /CwGQ87OLCH47DQozoomcVC7sMRNcwoYGVbxegYHf60favcZUxnW/g4r2KZAidqQD9Vt 11e8gJES6Kg5izz7zBdicT3kNAUY4YVg0Ft9t0yHcZ5dnU+qsNE8vRAbHrg0CqgnRuWc sRqw== 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=le0MHQk9HQYTwazHbeRMYTj7OI4RdAPESdb8VrJM2D8=; b=laIRIN+uR43YLbun1YjHvlbC5k2ZfnOMCPvqqnEd/Lh3CiQ+su5QDAF4OzEixmZvb3 +KKsjja+iFAcyoakxZdAt91sI8a0F06Vq5VHZVkEzuw7gla+rSfnOaRp8VYi6wrQeoJa xt0cLHK1NnACfEN6LDBW2Si/hHZZMREpw+VSMjYDAlqFbNmf+Uv2pUlsPnOHiar9CbTn arvqaZ+bnk/g4PtpUM6esp81UtP2kt++j0KZaJeJpCnkZK43rfEI1jJU0zFnMIX5l7bL /kapcrNp72Kb8YTFUPsSuuHgfZk6F1DQRcTd2px8rxP7bdbP21NpiDQq5hKje2BXlq6l AfSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JwhW9f+h; 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 e17-20020ac845d1000000b003a5dee51842si397561qto.456.2022.12.09.01.37.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 09 Dec 2022 01:37:52 -0800 (PST) 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=JwhW9f+h; 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] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p3Zoj-0004G9-Fv; Fri, 09 Dec 2022 04:37:17 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p3Zoh-0004Fd-Ep for qemu-devel@nongnu.org; Fri, 09 Dec 2022 04:37:15 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p3Zof-0003s9-K9 for qemu-devel@nongnu.org; Fri, 09 Dec 2022 04:37:15 -0500 Received: by mail-wm1-x32c.google.com with SMTP id j5-20020a05600c410500b003cfa9c0ea76so2984747wmi.3 for ; Fri, 09 Dec 2022 01:37:12 -0800 (PST) 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 :message-id:reply-to; bh=le0MHQk9HQYTwazHbeRMYTj7OI4RdAPESdb8VrJM2D8=; b=JwhW9f+hi/mAmWPhz7bJmfNq2GBFMd5apvMf+COEjuVJldNBzbT3KFeqOAlxfbTiX4 Kp+eBZwtZ13D3I3tgO+JsPmNR+O8CdkYbYwUvTgMUqYxgP8mN0Y3rSdhFa2aZhwueGll r914EpRUJZBQpr+M+tkh/gbPmkYZiZN1b9KbodvAqqpMqovjOyzRX5kmazJZ5Q2Y1aqI aclbmuaBqUqEUvO2zke0H1YW4SmZ5VYeZ8SFyrHOZ6mAN/EB4b9or+NmxvkiAUkt8MdT ULB7zmcv1bR726xUI8DZAeViwW7avvj1wBh7GyroyrCK0kKfCnt9rJWmUgHo0BP3nJa6 sLgQ== 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:message-id:reply-to; bh=le0MHQk9HQYTwazHbeRMYTj7OI4RdAPESdb8VrJM2D8=; b=C9pX2nQKMj+2cNaT58u0ERbxe2sysqkkwzDARhZ9J6dmAIe9ofgGOLvYIQ6FJeIotO 6IMSYdrUByxqfQceBcNiuJ2NR5WRq/MsedNQmvtJsFA53/JnDuskUekGhB87z5E+VjpS 5H1lTxlkgHohAR+nbOmJn9HoPh5JD93KXFg937xuvS9LzUsGOJUQE1Tmqh0MfYwl4+oZ QCQDB6qs1/gSJx/h/3OccK9zZcMPiHpii9WYaX1FvpnC7YCE99yly4z594TM0NSpYgg9 wL5z9a1hnIOz91YUSQwbaM0R5Q5vcxwA818UV6FeLHv8qKI6PAvVfyIlxNjAe6uqBCbC B8rQ== X-Gm-Message-State: ANoB5pmabd8vtdO5LbJS3nbgmW6C2izCag8TwpBxRt2fLl6OWwDEE7Xu jMxA60f5BofbhLfHEYLRPuS7oSoWQrAKiuP1OzA= X-Received: by 2002:a1c:7c18:0:b0:3cf:a6d9:7b3c with SMTP id x24-20020a1c7c18000000b003cfa6d97b3cmr4088228wmc.21.1670578631079; Fri, 09 Dec 2022 01:37:11 -0800 (PST) Received: from localhost.localdomain ([81.0.6.76]) by smtp.gmail.com with ESMTPSA id g6-20020a05600c4ec600b003cf57329221sm8899649wmq.14.2022.12.09.01.37.10 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 09 Dec 2022 01:37:10 -0800 (PST) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Richard Henderson , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , Paolo Bonzini , Stefan Hajnoczi , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Subject: [PATCH-for-8.0 4/5] accel/tcg: Factor tb_invalidate_phys_range_fast() out Date: Fri, 9 Dec 2022 10:36:48 +0100 Message-Id: <20221209093649.43738-5-philmd@linaro.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221209093649.43738-1-philmd@linaro.org> References: <20221209093649.43738-1-philmd@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=philmd@linaro.org; helo=mail-wm1-x32c.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-bounces+patch=linaro.org@nongnu.org Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée --- accel/tcg/cputlb.c | 5 +---- accel/tcg/internal.h | 3 +++ accel/tcg/tb-maint.c | 21 +++++++++++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index 6402fe11c1..03674d598f 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -1508,10 +1508,7 @@ static void notdirty_write(CPUState *cpu, vaddr mem_vaddr, unsigned size, trace_memory_notdirty_write_access(mem_vaddr, ram_addr, size); if (!cpu_physical_memory_get_dirty_flag(ram_addr, DIRTY_MEMORY_CODE)) { - struct page_collection *pages - = page_collection_lock(ram_addr, ram_addr + size); - tb_invalidate_phys_page_locked_fast(pages, ram_addr, size, retaddr); - page_collection_unlock(pages); + tb_invalidate_phys_range_fast(ram_addr, size, retaddr); } /* diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h index d8b58c1e70..db078390b1 100644 --- a/accel/tcg/internal.h +++ b/accel/tcg/internal.h @@ -42,6 +42,9 @@ void tb_invalidate_phys_page_locked_fast(struct page_collection *pages, uintptr_t retaddr); struct page_collection *page_collection_lock(tb_page_addr_t start, tb_page_addr_t end); +void tb_invalidate_phys_range_fast(ram_addr_t ram_addr, + unsigned size, + uintptr_t retaddr); void page_collection_unlock(struct page_collection *set); G_NORETURN void cpu_io_recompile(CPUState *cpu, uintptr_t retaddr); #endif /* CONFIG_SOFTMMU */ diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index bf84728910..4dc2fa1060 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1194,10 +1194,6 @@ void tb_invalidate_phys_range(tb_page_addr_t start, tb_page_addr_t end) } /* - * len must be <= 8 and start must be a multiple of len. - * Called via softmmu_template.h when code areas are written to with - * iothread mutex not held. - * * Call with all @pages in the range [@start, @start + len[ locked. */ void tb_invalidate_phys_page_locked_fast(struct page_collection *pages, @@ -1215,4 +1211,21 @@ void tb_invalidate_phys_page_locked_fast(struct page_collection *pages, tb_invalidate_phys_page_range__locked(pages, p, start, start + len, retaddr); } + +/* + * len must be <= 8 and start must be a multiple of len. + * Called via softmmu_template.h when code areas are written to with + * iothread mutex not held. + */ +void tb_invalidate_phys_range_fast(ram_addr_t ram_addr, + unsigned size, + uintptr_t retaddr) +{ + struct page_collection *pages; + + pages = page_collection_lock(ram_addr, ram_addr + size); + tb_invalidate_phys_page_locked_fast(pages, ram_addr, size, retaddr); + page_collection_unlock(pages); +} + #endif /* CONFIG_USER_ONLY */