From patchwork Fri Dec 16 18:53:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 634430 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp999240pvb; Fri, 16 Dec 2022 11:14:31 -0800 (PST) X-Google-Smtp-Source: AA0mqf5ZGmAnXZ/xKP1qSSX3r09FKTra9/03CRGCHnETyvPsbdX+DwdF7iI3yakgIuOUxkXWNT0U X-Received: by 2002:a1f:5983:0:b0:3bc:b966:2ccc with SMTP id n125-20020a1f5983000000b003bcb9662cccmr19782971vkb.0.1671218071681; Fri, 16 Dec 2022 11:14:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671218071; cv=none; d=google.com; s=arc-20160816; b=rNLDfD/bT6zt2FirRFeMijh0Sf5w2oGTmydZrbK2JLbWKNgvxbEZdBKtqvIH5hXHk5 +hd4Wtsezn5KmmLZTUdsbGhBSzNFziY6LjyUZMuPntoIJNcY2FDggil6qP2eiwQopth/ dXLHEsaYC568DngGxv3bzklbpOtemxocOy6N68ePaRB+KC5t29cFvtiKuyV+d+ZiRini fLqjvmO5BKFBBW/GkuHNl6XU8YkPCVmMQ/q7lPFU1Utbe9CVcSSmdPZVBUV8SCPZGkHq PDhhT5ErNi3N2slABZyvWoKiW0Byfd/OoLzbGtt9dmNe6jZA94Q7l71KY5xVXVY6G1nX o9tA== 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=cckxZafOwtkUwQnY45Ez0scvGBO1+RBqrS/Kwfy+GPI=; b=jpcrcAjnP7afQo2FIeKJ4MDhU9dr1479quxOXNtJF8nQbhiMyPL7RSrGkJuh4jj1eP Vouw62P7kN73g4rug9CLa1CsM5BKqHLUwIfVhGA5xqM3QibOwjYltpEuG1GxThsuZ9kc lNAH906U9pR3bLmlLK2WWCK1Sg8bokAIXlHDcTDwOkUn9dVTNtYPtW167eDUOLrvsGWI 3EKHVh89/dFwaCvmXZqFjPMytJeZoeE4PR1Ej8PRYU5j0o1nSL+zqFKr20dS8wzS9eos k7UhSm6QQtgfUeqd7wQs55NIxNUgmUm1MO++Y0X06jev4kacpQlUsnFVUdoyBnoWgQEC EmiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aRBHGlo9; 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 u14-20020a05620a454e00b006fc94e5f1efsi1535567qkp.175.2022.12.16.11.14.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 16 Dec 2022 11:14:31 -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=aRBHGlo9; 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 1p6Fq5-0000e6-1z; Fri, 16 Dec 2022 13:53:45 -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 1p6Fq1-0000cF-Ft for qemu-devel@nongnu.org; Fri, 16 Dec 2022 13:53:42 -0500 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p6Fpz-0003Hk-HJ for qemu-devel@nongnu.org; Fri, 16 Dec 2022 13:53:41 -0500 Received: by mail-pj1-x1030.google.com with SMTP id q17-20020a17090aa01100b002194cba32e9so7020175pjp.1 for ; Fri, 16 Dec 2022 10:53:39 -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=cckxZafOwtkUwQnY45Ez0scvGBO1+RBqrS/Kwfy+GPI=; b=aRBHGlo9cl1yPib7XKMPGRns2I2FuCcGsqzL38bNbe+ykJKRQeWyqWftrZo2B9c2j+ 5jZQD7V5LL3Okz0gdiaLkLFPyCYSep2vujo5Tff/rV5EgVN+88nncap9OU8voQe29mkb g3AWzhDXECzdq/OZYu3uLQo7TA9KE/LpQFQylgX5sWvXtO+12MLqIhqp5ECyk1FdN1cL u4t9EoP1+2lPirc09dsqWermqFfn3MRHv4qGXoNKxB5ScxNXPQTwGAQ/Sl39Oc/3bSZ2 223v2DdC46XS+HFFW9a2IgkuFYcay1SY9R69bx8bKyPPk0EeuO5IpravkmM6mTbWxzjY xVPw== 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=cckxZafOwtkUwQnY45Ez0scvGBO1+RBqrS/Kwfy+GPI=; b=QxjKa7EMY4hwHKd/7rVogY8Tc62TCEwyNNp69ciYNx0OHSag0khLJZOEnvGT8FfPTz cy5qtirOygfxVugeOKYugLy6QmQIJtZOcCkWV2QCCXmgmv6bFaV17IZjhG91HPKBBhm0 hd+tgQDI6U8Y/N68vytPlWFogGMDrztOAIxl47jnyy/LjXx86tlZl9FRy8rTUT/kNq2B /nH0X0gm3mK2J6BiS8+xBtcnh+W7uxy2NQ27uEI2DrjBxlc0dkj/LM16eiuS/xmmv7Z3 kJNxXwpWX5ZcAJkFuJC69chtGy+1Sjmjd7MtMpi5QxenMOVzHXSIKiD33nJ+VuPigrj0 MB/A== X-Gm-Message-State: ANoB5pnwQC29WBIGCslULSuxssWDJj24PJHApuhsj6uGGlG0PJEmhyHZ pGPfjfFXzK0H6LpKMNh9jUyuuEUx/XAW2bBj X-Received: by 2002:a05:6a20:1bdc:b0:ad:97cc:e948 with SMTP id cv28-20020a056a201bdc00b000ad97cce948mr21762670pzb.45.1671216818016; Fri, 16 Dec 2022 10:53:38 -0800 (PST) Received: from stoup.. ([2602:47:d48c:8101:c606:9489:98df:6a3b]) by smtp.gmail.com with ESMTPSA id 13-20020a630b0d000000b0046ff3634a78sm1761300pgl.71.2022.12.16.10.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Dec 2022 10:53:37 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , =?utf-8?q?Alex?= =?utf-8?q?_Benn=C3=A9e?= Subject: [PULL 12/13] accel/tcg: Factor tb_invalidate_phys_range_fast() out Date: Fri, 16 Dec 2022 10:53:04 -0800 Message-Id: <20221216185305.3429913-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221216185305.3429913-1-richard.henderson@linaro.org> References: <20221216185305.3429913-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1030; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1030.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 From: Philippe Mathieu-Daudé Signed-off-by: Philippe Mathieu-Daudé Reviewed-by: Alex Bennée Message-Id: <20221209093649.43738-5-philmd@linaro.org> Signed-off-by: Richard Henderson --- accel/tcg/internal.h | 3 +++ accel/tcg/cputlb.c | 5 +---- accel/tcg/tb-maint.c | 21 +++++++++++++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/accel/tcg/internal.h b/accel/tcg/internal.h index d10ab69ed0..8f8c44d06b 100644 --- a/accel/tcg/internal.h +++ b/accel/tcg/internal.h @@ -42,6 +42,9 @@ void tb_invalidate_phys_page_fast__locked(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/cputlb.c b/accel/tcg/cputlb.c index f7963d3af8..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_fast__locked(pages, ram_addr, size, retaddr); - page_collection_unlock(pages); + tb_invalidate_phys_range_fast(ram_addr, size, retaddr); } /* diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 8edfd910c4..d557013f00 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1184,10 +1184,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_fast__locked(struct page_collection *pages, @@ -1205,4 +1201,21 @@ void tb_invalidate_phys_page_fast__locked(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_fast__locked(pages, ram_addr, size, retaddr); + page_collection_unlock(pages); +} + #endif /* CONFIG_USER_ONLY */