From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BA81D2773F9 for ; Wed, 22 Jul 2026 12:33:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784723636; cv=none; b=E7jGnoDsTdBhGqyv8uL/MYly1iSh3O744t8/sNFSnyB2+lfJhDrByODhDGegzWWuUydl61egKlefnCiNjVjovAaZ8epSxRj/UwfxZtcUO+7t4Ys4Vv6/eHlkf/c4+wDmx/XntkqPyW+ioeINfwiaQAfyQj0YVOaXmqQ+z3NeY2k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784723636; c=relaxed/simple; bh=3d36uKCRaS6/IIOjkmtzpGmWZ1IFVmcVE5FcEMMWVfg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CuzKEV3+RXnLqVI6/9e5uxo5xlJh9Im7im5txdY319R+68G9dtOKputp9prNwKqeBoh6t/c3i575ikmbtYTxgaPQevafTfCEC2/7iEXNvG73GDd6Lu6qL9lIojWvKXtHf1LUTnYEYoPf+0SZAqbJ47/84pXCX/wk3Zr4FJrKFfo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=e0R083Ho; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="e0R083Ho" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2cf50c6f235so46691655ad.0 for ; Wed, 22 Jul 2026 05:33:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784723634; x=1785328434; darn=vger.kernel.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:content-type; bh=QxIfKuOVaE3EcHJclM4dn0Mc9MrDfV6Rgh6T8FHUwMI=; b=e0R083HodLs/Ohidv7dCkeD438iz47RqZHFFCzlaiUAmgKU3lw+3p28EoiJIxzxqkP qFGMPEe9clhrY4tWB60nbhllHHCtgdjNFEb3MVCPrE8w3CI25Zs4x73yhE/a8rlJ5zEa YDC5JeACa4i6fTc/rFf5Dd8T0WDr8txsMGsQKBbefPOj4ygTGMc1yLCeMu2pYAR1wRrD famS62z2dULw3fckqU/pGedAqp4fuKDvIY9RCRobajbZj0xYm1275Kkv3wTKHJDdW0Dx kM87UCQLF1n3/louX5dtp8J1JwReJM1mK95AfMlFEeq5eYUcuvLy9DlX2C3o+mTobVL/ p0oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784723634; x=1785328434; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=QxIfKuOVaE3EcHJclM4dn0Mc9MrDfV6Rgh6T8FHUwMI=; b=RlwfhEiaxxheO6ZKOseRY9K3q8+lv6xAXsWQzaZ7UlJqR3z4g5tY2yJqqLREFxyyRJ Hp5NuYNOYWueDzB8JjjNhtcMlE4krFq+SwnGOEvOKMGq+E4uF7a+YyYoyu5CRCL+hE+n zMdMeTgTu2ng6r3P1rAVDylIK4b76tellMqEhHhNV6ZGDZFXBLsr2qKyO+gLwdJwE4AK /kAdgrY4g1XmWiES9JTLryGIDaiW+MktRVDl/fYuMDI7DAlipSv77PGQzJYK6+gQb0eV F0kSz9tOATskKObAI2vqCb0zsbghMQBRGvOFaaVhoJ51Aq4CbIaazk0fpU/Y7YuGeK3e PZKQ== X-Forwarded-Encrypted: i=1; AHgh+Rq/piDJ4GsFc804H12QfbXxDMTUf/tJuGKwjXdwHWeIm8r397LRaaXdU1omtXmlmMyDHgdf0RF+NPFjVL0=@vger.kernel.org X-Gm-Message-State: AOJu0YxZOryov7HxmvItzv8LB68FNrbcRYhkrKdcQGKUU99FLxtw9BOx EobaxrVtn8qR8GbGevn6+g8sdZLpcc4MK0/R+hLQnlUy6kcGlWVdJNvR X-Gm-Gg: AR+sD125kF81MCKI5C+AZkKuYkEqHinK2LghGcQVWbHlUkkS3eBefTpjrWxZTJrp095 8SbyhYXlOyXVpQGLJBXwU+MTA/Y/isGB76sgnCB56xC5WJmNVv5/4RM/uOMw2/bkJ52IOdkLriY LqHmtWZX8CWjXvuM63meNHxbIcpwosls+e0yr314DhD+FCX1PHj/dEuCJcZzt2YU+gsOBeVl8HA 6BAQGJCHIO9PD+JfHGd3KhyvpUYlmkEZmqxkNtL9L4NVqxImfLYCQXDJ+uYffFzZFS2VTsMBQcX XXxkgQ9LWwkCLQ7icMnBKG1QneZN6ZX5aVLQDw+RA9YWiZNHJP/kRzZlKUnpn/Hy/Y5gUCDIZ64 vBui7kbrKHRjiLNiUhjHzb/fG5cHAWL2On88buzJQawuEdQSGEUt+nkqmriEnPjBvvKAqnZOa+s dia4quUwVSsijsIy07ygrO X-Received: by 2002:a17:902:e548:b0:2c8:4c29:afeb with SMTP id d9443c01a7336-2cf348213a8mr249494965ad.8.1784723633958; Wed, 22 Jul 2026 05:33:53 -0700 (PDT) Received: from cyh-System-Product-Name.. ([129.227.183.200]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2cf96ac33eesm7214735ad.72.2026.07.22.05.33.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Jul 2026 05:33:53 -0700 (PDT) From: "Yuhang.chen" To: bigeasy@linutronix.de Cc: anup@brainfault.org, atish.patra@linux.dev, clrkwllms@kernel.org, rostedt@goodmis.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev, zhouquan@iscas.ac.cn, "Yuhang . chen" Subject: Re: [PATCH] RISC-V: KVM: Use raw_spinlock for VMID update critical section Date: Wed, 22 Jul 2026 20:33:50 +0800 Message-Id: <20260722123350.3697232-1-yhchen312@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260717065137.FQ5Ax2W-@linutronix.de> References: <20260717065137.FQ5Ax2W-@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi Sebastian, thanks for having a look. On 2026-07-17 06:51:37 [+0000], Sebastian Andrzej Siewior wrote: > Here you state _why_ it must not be preempted. What would be the worst > that could happen. The worst case is an unbounded hold of vmid_lock that stalls guest entry system-wide. On rollover the section bumps vmid_version and then broadcasts a guest-TLB flush via on_each_cpu_mask(..., wait=1) before assigning a fresh VMID. Under PREEMPT_RT a plain spinlock_t is preemptible, so the holder could be scheduled out while still waiting for that broadcast flush to finish and keep vmid_lock held for an unbounded scheduling delay; every other vCPU reaching the VMID-(re)assignment path on its way into the guest would then block on the lock. The rollover is otherwise a short critical section (a version bump plus one IPI), so keeping it non-preemptible with raw_spinlock_t bounds its hold time. I'll fold that into the commit log. > That part starting with "Convert" belongs into into a new line. Will fix in v2. I'll send v2 with both changes. Yuhang