From patchwork Sun May 9 15:16:18 2021 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: 432876 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp2111838jao; Sun, 9 May 2021 08:25:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwHZPwpuUsdD1VK7oAX9sfyaT82A8zPKXDaFDVWu44Axa4UdpUUwFc09QMPnEl6fXN0O81y X-Received: by 2002:a67:8008:: with SMTP id b8mr16866740vsd.13.1620573926561; Sun, 09 May 2021 08:25:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620573926; cv=none; d=google.com; s=arc-20160816; b=Z11YViWufNmDGHupW4I/Jx/hklhBKtN2y/svcwzm7BdDBW2jkFocmx1/hwfGFZ+nb6 J6u2BgWqKPXNhxrr/M0i2MCTIbNw8C074jwl+GHBPa1wGMGcTbAEki79o4vAbv20856d O9xoCGOaYNfCnYa1sO4VGkf6ZTFADjkLoF91woy7IT2SLvvEkSyWriwM6ORwT1eMN1GB u0NxNp2ju4g9IjijLFZi+sP2rJzR5Btant2K1iaEnw9xXFNsIQuXVWSHEF4mXtGTxMnR YWT/pZPsZnOpCZ5bDx23orAC9PLqmjPhHETjmv/ZKBenUzqyuA4T/9GhpuetC1XULLrV 7qfg== 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=AOpOu7tS66FjHtPHNLuf/gpZjB/Q3PR0vAi0thAFl78=; b=fmrBsCDFU1TnLsHxdZh0UNO3V0YCCs+SCFmfATPuPSTn9FcrqCOgvURdfKpbzBOnef IGgrIkrGyJ6N38GXj2PrgcSuvCRAPa3y0zRRJq0zgRWsQ27SImSp9oBooPuyu50b+1p6 Dm+AJZPKHn4xTAbzJu5VjwB8WrM5Ml9pCbZ8GeDbmO1MGxFqYDGxZB+NMvappO0gyRNG 0K60Icfseqm2cVtUoaHXOqYRgFV0Q1MmJoXlOsdv+Uuq2ZxC2vBXFJlPPyuNxm60oJPv aWhHMa6X+qCkzs+zm+qnhp1TxOjowc8MHaNMLTHYSKy6wfimrYNZ9sfM8a1Pallc3dBf TsLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=VKKqMTjY; 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=amsat.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q1si5355658uar.92.2021.05.09.08.25.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Sun, 09 May 2021 08:25:26 -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=@gmail.com header.s=20161025 header.b=VKKqMTjY; 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=amsat.org Received: from localhost ([::1]:47588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lflJ7-0005df-UT for patch@linaro.org; Sun, 09 May 2021 11:25:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:43950) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lflB8-0005sl-P5 for qemu-devel@nongnu.org; Sun, 09 May 2021 11:17:10 -0400 Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:37578) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lflB7-0005gk-5b for qemu-devel@nongnu.org; Sun, 09 May 2021 11:17:10 -0400 Received: by mail-wr1-x430.google.com with SMTP id z6so13996931wrm.4 for ; Sun, 09 May 2021 08:17:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AOpOu7tS66FjHtPHNLuf/gpZjB/Q3PR0vAi0thAFl78=; b=VKKqMTjYJ/QP1ZoliCBPjA6kytDLigN8jwK4u6Fq+PaeuApWPtkJoQoqE7kM1vuwpP 4uh/FSJXutqo/s+6dg8lg/zkF1Civ2sUJ5vc9wJGTIs6d/RnzfsX33YuqNa+imPxhaQu tddiPQnC4OTNJepyPh6IVOh/g6Ot/QVItzUWMXIE5cOqR5OAJJnCfFDtHsp+7tf1Fzem EQXpIKkWjRvJNp0EeEoZJhQcEYxEUro2YjoEWhUwg6kXaeAlbMwOCdAU8UjTg7E2iAxL BlVZAq9lGA+kWSfPM+URf0pwtbXUQhF33LWaNIlxavP+zAFOkTWd6KQRRMr/LQsTsAXU gERw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=AOpOu7tS66FjHtPHNLuf/gpZjB/Q3PR0vAi0thAFl78=; b=S9rpxZz7zA0lRHp5h3xyjxw1ExS6KZqkKafTwYWUXGRwn9DvWKH0eqgiB8zhDtVi2l SdTmzZ+zFxaJ6pKjMj6LqiYEClXU1clJazqTLpFx/J14o6VUK8tDDaULh7QbjrpEn6Sb GyK8dx0OhJgSlCiAoZRgknI6yKSz+mPD9l92PwTMBVX6vwphs9HarWCuxXLy8FRUVeQZ j3Yjhj2nkJiWQVLajY+FrfAfVQKuTIYkCPtDBlVchwvqg6Q4i9Hl2GTeFQI/eT6IatvT rTT3RUnZWw3eGHxrytRsreuW5yYXJhXnrYktlt9dWqE7kjGglAyVsXSB9Q2dRmw3QRNH wWcQ== X-Gm-Message-State: AOAM531ljUaRXemxytcwnvVPjqlfeNH13g1w7HiNDsCuqi0TktdH6jiZ A0xknBtRJhXvJiMXsA7sf1UvVteHN7968+4S X-Received: by 2002:a5d:6383:: with SMTP id p3mr25377465wru.230.1620573427525; Sun, 09 May 2021 08:17:07 -0700 (PDT) Received: from localhost.localdomain (39.red-81-40-121.staticip.rima-tde.net. [81.40.121.39]) by smtp.gmail.com with ESMTPSA id j13sm18099051wrw.93.2021.05.09.08.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 May 2021 08:17:07 -0700 (PDT) From: =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Subject: [PATCH 9/9] accel/tcg: Remove tlb_flush_page_bits_by_mmuidx_async_1() ??? Date: Sun, 9 May 2021 17:16:18 +0200 Message-Id: <20210509151618.2331764-10-f4bug@amsat.org> X-Mailer: git-send-email 2.26.3 In-Reply-To: <20210509151618.2331764-1-f4bug@amsat.org> References: <20210509151618.2331764-1-f4bug@amsat.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::430; envelope-from=philippe.mathieu.daude@gmail.com; helo=mail-wr1-x430.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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: Paolo Bonzini , Richard Henderson , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Now than ... /* we use range? FILL ME... */ ... we can remove the encode_pbm_to_runon() and flush_all_helper() calls. Signed-off-by: Richard Henderson Message-Id: <20210508201640.1045808-1-richard.henderson@linaro.org> [PMD: Split from bigger patch] Signed-off-by: Philippe Mathieu-Daudé --- XXX proper description, commit might be placed earlier in series. --- accel/tcg/cputlb.c | 86 +++++++++++----------------------------------- 1 file changed, 20 insertions(+), 66 deletions(-) -- 2.26.3 diff --git a/accel/tcg/cputlb.c b/accel/tcg/cputlb.c index ad0e44bce63..2f7088614a7 100644 --- a/accel/tcg/cputlb.c +++ b/accel/tcg/cputlb.c @@ -788,34 +788,6 @@ static void tlb_flush_range_by_mmuidx_async_0(CPUState *cpu, } } -static bool encode_pbm_to_runon(run_on_cpu_data *out, - TLBFlushRangeData d) -{ - /* We need 6 bits to hold to hold @bits up to 63. */ - if (d.idxmap <= MAKE_64BIT_MASK(0, TARGET_PAGE_BITS - 6)) { - *out = RUN_ON_CPU_TARGET_PTR(d.addr | (d.idxmap << 6) | d.bits); - return true; - } - return false; -} - -static TLBFlushRangeData -decode_runon_to_pbm(run_on_cpu_data data) -{ - target_ulong addr_map_bits = (target_ulong) data.target_ptr; - return (TLBFlushRangeData){ - .addr = addr_map_bits & TARGET_PAGE_MASK, - .idxmap = (addr_map_bits & ~TARGET_PAGE_MASK) >> 6, - .bits = addr_map_bits & 0x3f - }; -} - -static void tlb_flush_page_bits_by_mmuidx_async_1(CPUState *cpu, - run_on_cpu_data runon) -{ - tlb_flush_range_by_mmuidx_async_0(cpu, decode_runon_to_pbm(runon)); -} - static void tlb_flush_range_by_mmuidx_async_1(CPUState *cpu, run_on_cpu_data data) { @@ -829,7 +801,6 @@ void tlb_flush_range_by_mmuidx(CPUState *cpu, target_ulong addr, unsigned bits) { TLBFlushRangeData d; - run_on_cpu_data runon; /* * If all bits are significant, and len is small, @@ -853,8 +824,6 @@ void tlb_flush_range_by_mmuidx(CPUState *cpu, target_ulong addr, if (qemu_cpu_is_self(cpu)) { tlb_flush_range_by_mmuidx_async_0(cpu, d); - } else if (encode_pbm_to_runon(&runon, d)) { - async_run_on_cpu(cpu, tlb_flush_page_bits_by_mmuidx_async_1, runon); } else { /* Otherwise allocate a structure, freed by the worker. */ TLBFlushRangeData *p = g_memdup(&d, sizeof(d)); @@ -874,7 +843,7 @@ void tlb_flush_range_by_mmuidx_all_cpus(CPUState *src_cpu, uint16_t idxmap, unsigned bits) { TLBFlushRangeData d; - run_on_cpu_data runon; + CPUState *dst_cpu; /* * If all bits are significant, and len is small, @@ -896,19 +865,13 @@ void tlb_flush_range_by_mmuidx_all_cpus(CPUState *src_cpu, d.idxmap = idxmap; d.bits = bits; - if (encode_pbm_to_runon(&runon, d)) { - flush_all_helper(src_cpu, tlb_flush_page_bits_by_mmuidx_async_1, runon); - } else { - CPUState *dst_cpu; - - /* Allocate a separate data block for each destination cpu. */ - CPU_FOREACH(dst_cpu) { - if (dst_cpu != src_cpu) { - TLBFlushRangeData *p = g_memdup(&d, sizeof(d)); - async_run_on_cpu(dst_cpu, - tlb_flush_range_by_mmuidx_async_1, - RUN_ON_CPU_HOST_PTR(p)); - } + /* Allocate a separate data block for each destination cpu. */ + CPU_FOREACH(dst_cpu) { + if (dst_cpu != src_cpu) { + TLBFlushRangeData *p = g_memdup(&d, sizeof(d)); + async_run_on_cpu(dst_cpu, + tlb_flush_range_by_mmuidx_async_1, + RUN_ON_CPU_HOST_PTR(p)); } } @@ -929,8 +892,8 @@ void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *src_cpu, uint16_t idxmap, unsigned bits) { - TLBFlushRangeData d; - run_on_cpu_data runon; + TLBFlushRangeData d, *p; + CPUState *dst_cpu; /* * If all bits are significant, and len is small, @@ -952,27 +915,18 @@ void tlb_flush_range_by_mmuidx_all_cpus_synced(CPUState *src_cpu, d.idxmap = idxmap; d.bits = bits; - if (encode_pbm_to_runon(&runon, d)) { - flush_all_helper(src_cpu, tlb_flush_page_bits_by_mmuidx_async_1, runon); - async_safe_run_on_cpu(src_cpu, tlb_flush_page_bits_by_mmuidx_async_1, - runon); - } else { - CPUState *dst_cpu; - TLBFlushRangeData *p; - - /* Allocate a separate data block for each destination cpu. */ - CPU_FOREACH(dst_cpu) { - if (dst_cpu != src_cpu) { - p = g_memdup(&d, sizeof(d)); - async_run_on_cpu(dst_cpu, tlb_flush_range_by_mmuidx_async_1, - RUN_ON_CPU_HOST_PTR(p)); - } + /* Allocate a separate data block for each destination cpu. */ + CPU_FOREACH(dst_cpu) { + if (dst_cpu != src_cpu) { + p = g_memdup(&d, sizeof(d)); + async_run_on_cpu(dst_cpu, tlb_flush_range_by_mmuidx_async_1, + RUN_ON_CPU_HOST_PTR(p)); } - - p = g_memdup(&d, sizeof(d)); - async_safe_run_on_cpu(src_cpu, tlb_flush_range_by_mmuidx_async_1, - RUN_ON_CPU_HOST_PTR(p)); } + + p = g_memdup(&d, sizeof(d)); + async_safe_run_on_cpu(src_cpu, tlb_flush_range_by_mmuidx_async_1, + RUN_ON_CPU_HOST_PTR(p)); } void tlb_flush_page_bits_by_mmuidx_all_cpus_synced(CPUState *src_cpu,