From patchwork Thu Sep 14 17:44:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 722576 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp527712wro; Thu, 14 Sep 2023 10:45:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEEpzB5V8EwiJBKFgJq9/xa0MKWc4cG8VFmzd3iUrkFBGAYb7sM1Al3P/5rreJi+zEPwYGo X-Received: by 2002:a05:620a:2907:b0:76f:a86:65bd with SMTP id m7-20020a05620a290700b0076f0a8665bdmr7901186qkp.53.1694713556982; Thu, 14 Sep 2023 10:45:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694713556; cv=none; d=google.com; s=arc-20160816; b=whK0nQL8SfNPLlgQ8P2dGHNBgxuYyLQ1eAX6kc4alaTcx4T5g1+uBFu48tQrRQNlZM NO0OrHWNBrp7it0xGSJbQWdjXOQM7SPtOPT1lrJwBXpbY7UMK5fZPbraK0Iw9eSHEjoY 9PqqEDS9No248G8xt68qR1lBOuEi1q81rohZNFYw49jmksVuI/Be14t7tFTnNDn3NNk/ y0QjlYba6z/8G8sKDWyR2ydyg3zldtvXy5bGHJ1+fEpStZV3Gz6PanWoMSJkl7YQSx/q LQslv9OTbbRlcd7dzCNvfo3uZTJI1cAiBrT/KHzVrTcqXIoLSOL+h+/c763muhejYke5 fT0Q== 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=8PvdEJV3jhqsKSWl/RxX9U8TRziNTQDBkGzBSJuHzFo=; fh=ycigHkwOPieh2u5PmcA89sNk/qPD1ZkdDlL8Mchfvw8=; b=mntWpDqfUkZ3rerFCyADLGR/8w4gMwsXnxwLrzecqc2jQ7CcE5T4K89htflKsJ+jHB VN4LI22iiJtOxT4HVaUsDyfojTEOknntRfMRj3YR39rtgLquHa2PhfOQPG8TEw1Axwrp ufxV+a+FXY4xsXtxQm5RAcwwvxo1PJI61Jc7yjLj18eIAsM23itaGSNkOy2kfgMTXJfp UnNWpM8OIUd+dZKqiAIOE0CTqbRcU6ML6li8WqSVz3XSZTcaNreGx5Rx1LTJUoqgeciR 1YSdNnk0Cc5iGPGivxDsWJJmd0tsMF1mPq9l9FXsL53IC0zLSVD2sj4M8Yz1/L/SfsuC mImA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oE8Z0mf6; 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 b17-20020a05620a04f100b00770728e885bsi1194092qkh.316.2023.09.14.10.45.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 14 Sep 2023 10:45:56 -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=oE8Z0mf6; 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 1qgqOZ-0000kw-DE; Thu, 14 Sep 2023 13:44:51 -0400 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 1qgqOV-0000fW-5q for qemu-devel@nongnu.org; Thu, 14 Sep 2023 13:44:47 -0400 Received: from mail-pf1-x432.google.com ([2607:f8b0:4864:20::432]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qgqOS-00070L-1j for qemu-devel@nongnu.org; Thu, 14 Sep 2023 13:44:46 -0400 Received: by mail-pf1-x432.google.com with SMTP id d2e1a72fcca58-68a3ced3ec6so1114565b3a.1 for ; Thu, 14 Sep 2023 10:44:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694713482; x=1695318282; darn=nongnu.org; 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=8PvdEJV3jhqsKSWl/RxX9U8TRziNTQDBkGzBSJuHzFo=; b=oE8Z0mf6l+c1eGu4vpXVRgO9kLwQVxzGGS5q7Zc03PDV98VDZs5NlYAgmyOvfVEFXp M97SswfZ1pkofCUqdLXTEkkt0B0s0J0Bs1LwZjR1kAA8ZTyJVRsu5FGRm+6FJJWkTJg8 BgZ/Rhm4lywot/fe1BLcwzHsd2Vv2+fLCOJuLQEKvfKYFq/Pn83PUv+5b2bh37WkX9Zr uyRSaQJhIxPAYLGmY09uPh0j+mdaeked7DL+tTNF2njuvHspgvKUqFS1HY4s4PisACc/ fLDCI9sTZVH1T7B/vkf6JBv2Nlks2lEJl2V+kfCw+C0hY5RxYQq+l5vQT/5byq65vlDh whiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694713482; x=1695318282; 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=8PvdEJV3jhqsKSWl/RxX9U8TRziNTQDBkGzBSJuHzFo=; b=lrrDog9jjQNeuMLpE5GtdzzlIHV86pfXPYWj0Xw1G0V3yW/nYo1E2BhdMwAk4Hlh3H PcZpSgrlE9a7mkkyj/P4lCw/cr9LnBA1zAq2utnTPtAywSVQ4niPQ13/SlzB4G3tP0RG y0wgXO+12Ewsu17eM6k/Xz+KbLpU21qU7i7WUJL3y3Jqm90LVkQ/FL4z0Dzu2XF7ASOD PKK3FkK/HD4xKQkuzsNmwFRXBR0jg0zUBZMU7pmArrbLtAWzuqBhY/HJo/9IykLl/YQH GPGtNvdi7zxLsfEeNW+xxz7pHKkpfTOwR4ipcCC5CBhiOg+bm0iQLSWXifr4HeXzhoBY VGUA== X-Gm-Message-State: AOJu0Yzn+uL9R6YD8CLa9fF06KWQm3QsqjWJN6Q54Qyjkm0qAy2BrQe4 o37PIkjTKlbYIDYqhjHWDJRAz+5ygXHjchtMBKk= X-Received: by 2002:a05:6a21:6d84:b0:132:a85f:b20c with SMTP id wl4-20020a056a216d8400b00132a85fb20cmr7422194pzb.38.1694713482655; Thu, 14 Sep 2023 10:44:42 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id w17-20020aa78591000000b0068c5bd3c3b4sm1588933pfn.206.2023.09.14.10.44.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 10:44:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: philmd@linaro.org Subject: [PATCH 5/6] accel/tcg: Always set CF_LAST_IO with CF_NOIRQ Date: Thu, 14 Sep 2023 10:44:35 -0700 Message-Id: <20230914174436.1597356-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230914174436.1597356-1-richard.henderson@linaro.org> References: <20230914174436.1597356-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::432; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x432.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 Without this we can get see loops through cpu_io_recompile, in which the cpu makes no progress. Signed-off-by: Richard Henderson Reviewed-by: Philippe Mathieu-Daudé --- accel/tcg/cpu-exec.c | 2 +- accel/tcg/tb-maint.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index e2c494e75e..c724e8b6f1 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -720,7 +720,7 @@ static inline bool cpu_handle_exception(CPUState *cpu, int *ret) && cpu_neg(cpu)->icount_decr.u16.low + cpu->icount_extra == 0) { /* Execute just one insn to trigger exception pending in the log */ cpu->cflags_next_tb = (curr_cflags(cpu) & ~CF_USE_ICOUNT) - | CF_NOIRQ | 1; + | CF_LAST_IO | CF_NOIRQ | 1; } #endif return false; diff --git a/accel/tcg/tb-maint.c b/accel/tcg/tb-maint.c index 32ae8af61c..0c3e227409 100644 --- a/accel/tcg/tb-maint.c +++ b/accel/tcg/tb-maint.c @@ -1083,7 +1083,8 @@ bool tb_invalidate_phys_page_unwind(tb_page_addr_t addr, uintptr_t pc) if (current_tb_modified) { /* Force execution of one insn next time. */ CPUState *cpu = current_cpu; - cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(current_cpu); + cpu->cflags_next_tb = + 1 | CF_LAST_IO | CF_NOIRQ | curr_cflags(current_cpu); return true; } return false; @@ -1153,7 +1154,8 @@ tb_invalidate_phys_page_range__locked(struct page_collection *pages, if (current_tb_modified) { page_collection_unlock(pages); /* Force execution of one insn next time. */ - current_cpu->cflags_next_tb = 1 | CF_NOIRQ | curr_cflags(current_cpu); + current_cpu->cflags_next_tb = + 1 | CF_LAST_IO | CF_NOIRQ | curr_cflags(current_cpu); mmap_unlock(); cpu_loop_exit_noexc(current_cpu); }