From patchwork Fri Oct 29 04:33:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 516434 Delivered-To: patch@linaro.org Received: by 2002:ad5:5208:0:0:0:0:0 with SMTP id p8csp432948iml; Thu, 28 Oct 2021 22:40:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9R0CE6S8dNdPO7H9q3oUaqT75JuMnpz+a5uAxiZdL44kMinOGRxxQteJsvhA6Dw04cfjN X-Received: by 2002:a9d:4b94:: with SMTP id k20mr7063704otf.203.1635486006122; Thu, 28 Oct 2021 22:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635486006; cv=none; d=google.com; s=arc-20160816; b=tHf1amYu5MX2g7R65ouM5/ykM3MUVrxmxZPFcfgSTBBvMKT8Nw45hoMKrCM1eR5A0W NZdwaAomQo532xt4K/7MGzYNXoPi/sXHXTk12RqHpHyCw8r7jTrR+7QvAza1/GZuhCWt oa1Hm7oEcZzY1bBc7U+Q0YGiAeSW2CTpQeNbWvO14MVPhtKiFr1yvvJl4q7UYCiqXe4G kImLjPHdt/4qNuhzRx0g1Q8I97AiWXz7JMQPrxhv2uwpXbnh4tGaI7W+3nWy8BE+5rRZ kd9rsHeRtWLB22MCH4g4AgdOL/ce9JunyciPVf0IhqxmfRNlKptwy/rhzfS9ytA9K8Fc ILMw== 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=5hZhX5vZU8BaEoiEK8fUOl4WiuruFQqSWFfGeVps8ww=; b=dzrDrG/ydm9Fyn8TbmamHR5YZvkUhDeC44ZutA1CQLVyf85FzYmmOlYYLTdQVWWKt2 x4K8fB/ayrV1iqlzVpf0aLjlyPEIam6GADdK1RUZTboB3NLEURmlp1vPBNA0+OCnkf+x WFz/IJTuvl6hN00UOyqnH5tRfuUhXBvO4/xT4j2r/7mED6gQTUit+rhAikTNxq6+ez4V PvF0bbmd/1nllVLzcEV2DD9sIZeTHcFUaaI/XTYGYY4uoVqYkhvGUm6T9+YoPUfD33rY UteaRiCa5pNGT5GIMWekEC9mFdO2P9q9FIMqnIB//QCNDfrYKhLYLc0TBJtyXF//PtNi fs4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=pWjoOQhF; 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=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g97si1426186otb.269.2021.10.28.22.40.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Oct 2021 22:40:06 -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=@linaro.org header.s=google header.b=pWjoOQhF; 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=linaro.org Received: from localhost ([::1]:53388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mgKcX-0005Jp-EV for patch@linaro.org; Fri, 29 Oct 2021 01:40:05 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52252) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mgJdt-0002et-Aw for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:37:26 -0400 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]:45754) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mgJdn-0000Pi-JJ for qemu-devel@nongnu.org; Fri, 29 Oct 2021 00:37:25 -0400 Received: by mail-pl1-x62d.google.com with SMTP id f8so5984420plo.12 for ; Thu, 28 Oct 2021 21:37:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5hZhX5vZU8BaEoiEK8fUOl4WiuruFQqSWFfGeVps8ww=; b=pWjoOQhFKnnPZc+E8KGK8kqWSqfuy1D83OPxWlfT3UKehb6SD8QmJvFvlJbFc+jKr5 DGqTFW2ZsczNZBiQ4ytfFXG58QR1CLJaZBgCVBb1Seu8RBQHlZpt2QY/NVHrDVd3I3jh 82z8Q5ginFlv6UYRcdVjZvt4cFwIidlbYJSq4v6M/CdBceHRYqpGCQZ0bFLK7JQ6wkO+ EDADIDg28/0LNFmA0MVCSj2NbpDOjjAl7NlZXzJSB2HbC7xdzl9LbqCJFFlP3gyHdP36 8DlRrdtK6iD3e8KmWLXXwPiXekIrocGvmhI5FtwS8vyNWz+1w4wV5cq9sDJbUkpNXHKk jGIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5hZhX5vZU8BaEoiEK8fUOl4WiuruFQqSWFfGeVps8ww=; b=P2x+CGBeCirGG2fgepzbZoa6tFrAt0U/UCXZUs7jjI6ggbpLbI5h0Fs45TijmhQBCp X6Ou4wT8IqMIQfPo6NUExNhAmqK+uzQ1VFLY6EEd+TjPV1y0LUOvb9nMR/QvqXp4F8J/ jLW4SDycrBGHAd3t22/dVl3Z4CcPQVWsrCQ4UhWHtGrP/XuFFAlIHTVYFufQuKa5qt+M vr5g5SN87adVu7YkVjSzKJrc2Kb7zbZJT3r5h+Z4oBc0VBowTR6PUoC7/q1AxjfrK4I6 3sqc4OTjmJPRbO2AcS/I+ArFANtTutj/JO3AOzPxswAt533puE+9A5pskJAhZrHlXvtz ZB1Q== X-Gm-Message-State: AOAM531U622wdaNRKqHdU9P+etDN3j3303L4srtnzOEXYxuemqmLdn5d FfTrBfd/YuUPqhH3gPBAzLZaXtcspUKGMw== X-Received: by 2002:a17:902:7608:b0:141:9a53:ceff with SMTP id k8-20020a170902760800b001419a53ceffmr5294320pll.78.1635482238407; Thu, 28 Oct 2021 21:37:18 -0700 (PDT) Received: from localhost.localdomain (174-21-75-75.tukw.qwest.net. [174.21.75.75]) by smtp.gmail.com with ESMTPSA id b8sm5228232pfv.56.2021.10.28.21.37.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 21:37:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Subject: [PULL v2 59/60] softmmu: remove useless condition in watchpoint check Date: Thu, 28 Oct 2021 21:33:28 -0700 Message-Id: <20211029043329.1518029-60-richard.henderson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211029043329.1518029-1-richard.henderson@linaro.org> References: <20211029043329.1518029-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pavel Dovgalyuk Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Pavel Dovgalyuk cpu_check_watchpoint function checks cpu->watchpoint_hit at the entry. But then it also does the same in the middle of the function, while this field can't change. That is why this patch removes this useless condition. Signed-off-by: Pavel Dovgalyuk Reviewed-by: Richard Henderson Message-Id: <163542169094.2127597.8801843697434113110.stgit@pasha-ThinkPad-X280> Signed-off-by: Richard Henderson --- softmmu/physmem.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) -- 2.25.1 diff --git a/softmmu/physmem.c b/softmmu/physmem.c index d58752678d..9765a509d2 100644 --- a/softmmu/physmem.c +++ b/softmmu/physmem.c @@ -929,27 +929,26 @@ void cpu_check_watchpoint(CPUState *cpu, vaddr addr, vaddr len, } wp->hitaddr = MAX(addr, wp->vaddr); wp->hitattrs = attrs; - if (!cpu->watchpoint_hit) { - if (wp->flags & BP_CPU && cc->tcg_ops->debug_check_watchpoint && - !cc->tcg_ops->debug_check_watchpoint(cpu, wp)) { - wp->flags &= ~BP_WATCHPOINT_HIT; - continue; - } - cpu->watchpoint_hit = wp; - mmap_lock(); - /* This call also restores vCPU state */ - tb_check_watchpoint(cpu, ra); - if (wp->flags & BP_STOP_BEFORE_ACCESS) { - cpu->exception_index = EXCP_DEBUG; - mmap_unlock(); - cpu_loop_exit(cpu); - } else { - /* Force execution of one insn next time. */ - cpu->cflags_next_tb = 1 | curr_cflags(cpu); - mmap_unlock(); - cpu_loop_exit_noexc(cpu); - } + if (wp->flags & BP_CPU && cc->tcg_ops->debug_check_watchpoint && + !cc->tcg_ops->debug_check_watchpoint(cpu, wp)) { + wp->flags &= ~BP_WATCHPOINT_HIT; + continue; + } + cpu->watchpoint_hit = wp; + + mmap_lock(); + /* This call also restores vCPU state */ + tb_check_watchpoint(cpu, ra); + if (wp->flags & BP_STOP_BEFORE_ACCESS) { + cpu->exception_index = EXCP_DEBUG; + mmap_unlock(); + cpu_loop_exit(cpu); + } else { + /* Force execution of one insn next time. */ + cpu->cflags_next_tb = 1 | curr_cflags(cpu); + mmap_unlock(); + cpu_loop_exit_noexc(cpu); } } else { wp->flags &= ~BP_WATCHPOINT_HIT;