From patchwork Sat Sep 16 03:29:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 723548 Delivered-To: patch@linaro.org Received: by 2002:adf:f0d1:0:b0:31d:da82:a3b4 with SMTP id x17csp708678wro; Fri, 15 Sep 2023 20:31:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFDgJsLrAK8hb+xMeTzAzddVxuev+5TRkZ1AoYvLw/ET9l5mQ4nAd2xwJfa+Ju6JupyT4ax X-Received: by 2002:a05:622a:186:b0:410:99df:688f with SMTP id s6-20020a05622a018600b0041099df688fmr4697020qtw.12.1694835109583; Fri, 15 Sep 2023 20:31:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694835109; cv=none; d=google.com; s=arc-20160816; b=T5VdkAiUPA54WOaWtTZe27aOV0fMQ2qlUxhhDyYqaEdlT8uhvNxeXGcvGVGG24rLVI E55Y7M8Gro04XpgQv6un48MrWqHy2AY41IAd/6dDwNoA9xJ93YlxyEKk5pES8ufr3i0l 9w9FEhJEL+/NRPBzLXw7SUb/PIstydPcwopJkP2hJ+8mxv3YtaAvSILDrk73bXuGS0J+ QOM3M/yXU7HrJ4+NC92slPmpsaV12iz700TEMMn3tf0Wh/y9x6ihPH3KxpRNvCeLV4Ip Szs/Qp8jyqJbRixBtCA21cIyXFLqjrYbFP3GOFv5WWtlOXlxQdN5gQ6TlckKotOwG3gR +Gyg== 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=wpsTd2fMb3n+PPnNCGSH2JmhVc/GBkL2FsB8m4U3Ra8=; fh=77XB70samAE/FKmTKdAWLiYRWglyXN3LlQzOsjFv+qI=; b=iStuAwoC8TODc3UGemlkk67cFV1jDlU2AFlOkEV9QJBsK0jj1fq6yM85933X9jw25X P0kY91AXLddt1hgHNuVaPmxBygpcMWPg0rMMg3wR4Go/tjPO4o2Jel0gwbQ1L7xyL//9 AG5cGLAPdwA3Vr1hyRlFr0R4Z0ctPKSbMpu7WFxcpYQYVg9twCRhIVxGqoB1Fh2F6LZy eKPDf+edlm85I8+9nAvJS51bCUiSCqa1L8x5avZwTubMI+YTVf+1Iy1i/P5+E/AJB5cu UgwrubtWsgM09sc3joUdK35bpXDmJS6X586lEMLKtl2HmNzT8AwNTBwiyncHPK0H5bUO bQMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rsk+8Pl1; 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 c11-20020ac87dcb000000b003f91737aa85si3305754qte.144.2023.09.15.20.31.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 15 Sep 2023 20:31:49 -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=Rsk+8Pl1; 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 1qhM0h-0005sh-SP; Fri, 15 Sep 2023 23:30:19 -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 1qhM0f-0005ry-TX for qemu-devel@nongnu.org; Fri, 15 Sep 2023 23:30:17 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qhM0e-0007yH-7g for qemu-devel@nongnu.org; Fri, 15 Sep 2023 23:30:17 -0400 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-68fbbb953cfso2449788b3a.2 for ; Fri, 15 Sep 2023 20:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694835014; x=1695439814; 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=wpsTd2fMb3n+PPnNCGSH2JmhVc/GBkL2FsB8m4U3Ra8=; b=Rsk+8Pl1JXlpe5veeYGql+1S759gCRR/J84Ni1vRgFmVCCoiGk+ZfNHHTp+VH1H5+l GicFN7v7QZ6LE4fiGCsGTKxTGC/+vio29jmsR3XLvuajYMRHyuqzUzszyeux5kL2TtbZ rgrOfkb6ke1TyyUIXHXeDzG/6uty+GAB7TyhYXMnvPvSCzuKD8mCPAV0P6amMZBVpFi6 1wBc6VK5XlOHRWlKqsmqH/y0vQKSvyNst8vjpJY1/3JViLYKv/tfNvDb0Ga/mXVB0HVY JE+1mGydKhGbxK6gvxb5SMxM6/HcGNp5NnRrJoV6Cbrq+1VFKOCOy32zcyDEpOhfWwzO eURw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694835014; x=1695439814; 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=wpsTd2fMb3n+PPnNCGSH2JmhVc/GBkL2FsB8m4U3Ra8=; b=e8GESxOU7z/tObsGRxBtrwZJlNrtHhYKtf1HgLFYUX0xGYc24Sc1RYGPQV/f/ocec2 F1b6r9wqhpkB2Z6AbmJMwvD78ZXCAheOwQB3MOmxITojhxDwXjJ3h+yt+y0I8WXGEOF7 r0G5WVozXMWeS7V/UwskuLaHrY8WhDMJ2Ky6eaM+8YqoIkMPzfYQXf5tiv5tcCcD9YSt IL1Bts5WAIByA4THbJsH4dbjPUlpH+H4ST7g4NDaung1AlrVC80D03gxTFS0/C0kc0Tm tEuGwhv3Tg9Aeub+f5aLrN2RDJJduD7eLP85WDngoFKEwxESgSuwW3hRmHhGQm9wYMl1 3msQ== X-Gm-Message-State: AOJu0Yz3oU2VR7edw/QmkYxIxKrJP5mRE1tbGvJh8YLizNNkkqrmLjlp /mNvhN5Rt8HB9Uz9OvDfE+i7B6GBq1gjsST6i/g= X-Received: by 2002:a05:6a00:180f:b0:690:2818:a4ce with SMTP id y15-20020a056a00180f00b006902818a4cemr4654927pfa.7.1694835014496; Fri, 15 Sep 2023 20:30:14 -0700 (PDT) Received: from stoup.. ([71.212.131.115]) by smtp.gmail.com with ESMTPSA id j26-20020aa783da000000b00687a4b70d1esm3577320pfn.218.2023.09.15.20.30.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 20:30:14 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: Nicholas Piggin , Ivan Warren Subject: [PULL 01/39] accel/tcg: mttcg remove false-negative halted assertion Date: Fri, 15 Sep 2023 20:29:33 -0700 Message-Id: <20230916033011.479144-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230916033011.479144-1-richard.henderson@linaro.org> References: <20230916033011.479144-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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: Nicholas Piggin mttcg asserts that an execution ending with EXCP_HALTED must have cpu->halted. However between the event or instruction that sets cpu->halted and requests exit and the assertion here, an asynchronous event could clear cpu->halted. This leads to crashes running AIX on ppc/pseries because it uses H_CEDE/H_PROD hcalls, where H_CEDE sets self->halted = 1 and H_PROD sets other cpu->halted = 0 and kicks it. H_PROD could be turned into an interrupt to wake, but several other places in ppc, sparc, and semihosting follow what looks like a similar pattern setting halted = 0 directly. So remove this assertion. Reported-by: Ivan Warren Signed-off-by: Nicholas Piggin Message-Id: <20230829010658.8252-1-npiggin@gmail.com> [rth: Keep the case label and adjust the comment.] Signed-off-by: Richard Henderson --- accel/tcg/tcg-accel-ops-mttcg.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/accel/tcg/tcg-accel-ops-mttcg.c b/accel/tcg/tcg-accel-ops-mttcg.c index b276262007..4b0dfb4be7 100644 --- a/accel/tcg/tcg-accel-ops-mttcg.c +++ b/accel/tcg/tcg-accel-ops-mttcg.c @@ -100,14 +100,9 @@ static void *mttcg_cpu_thread_fn(void *arg) break; case EXCP_HALTED: /* - * during start-up the vCPU is reset and the thread is - * kicked several times. If we don't ensure we go back - * to sleep in the halted state we won't cleanly - * start-up when the vCPU is enabled. - * - * cpu->halted should ensure we sleep in wait_io_event + * Usually cpu->halted is set, but may have already been + * reset by another thread by the time we arrive here. */ - g_assert(cpu->halted); break; case EXCP_ATOMIC: qemu_mutex_unlock_iothread();