Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp257587lqb; Tue, 16 Apr 2024 15:03:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXTRyGJcDJpbS4pOQuDDHAQzaLwtXGcV/VfyRplLWS3VWPSoAr7/1laiF1+hrEVyx5BHbACFLbd7XfacKGmrCxBV0wI7C/jzOmXqRhGcA== X-Google-Smtp-Source: AGHT+IHmhFkcBOhFqRGJmoKg2ebRN2QUSh6F9VJBjc2p4CC4+9fmshHgt79cnAynxwKmUwByMxrR X-Received: by 2002:a05:6a20:100e:b0:1a7:5fe0:1c96 with SMTP id gs14-20020a056a20100e00b001a75fe01c96mr11392211pzc.23.1713305030826; Tue, 16 Apr 2024 15:03:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713305030; cv=pass; d=google.com; s=arc-20160816; b=FlFZex+fCzgZ3PRY3StX7ONdvSPYRqfDhsbrZgp6c4D5kOZ9ZibgPo3/puZNYxRJBJ cGhjptWkzGg34dFpvx6J0mV9sssBB9ET03674PjIgkA1O6Cw49tZwWnIL22tmcDFTrco NF782S5BkGmrmVYAjJ3PwOizlH3DUMmSRi6VIWGBiBAe2ZcjEG1n4vsh6znrHhEhe0ch E3/ktcMApL3fYvK/Ln+2OJGx+nZ9v55DPsdKMRucMJEmb4r6dFBzApUeLGMJWqUhGvnd mwm/XYFuu4TFLsj6dKEFdHMitu3iWKOrHR+XbcNFiYP086/v8xTmSTyOgpYnk6hECzFC DK9g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=0mXC6erWL5zoj0Mw8kxXnTBZ+XFTfEZhlYEfC3KPt4Q=; fh=McOKULKBU3HLwHKplfPY4EZtOa9+jGZiGyBoeY/gdpw=; b=F4VxoKbrJBqnzkRhEFleb97NjYueUMOBQtSuAszlqXXF84Uee/gj03lpKMMGtrvwAy AG8X+DDk8uy3iI+GBFSeHtsJjCedlVYqYvaHaEZlOjxfyBWia4x5V5yM7BXe2WJj/zZW /gkyK+dsobNvt5I2sW2KxW8qLi/VzxfDxW85PU3y+wW3RhHc0KYlvnwBVzF4/79im9MW vQnRUnNFFO0M0bhVMJU2+mxkfc/PHuwZ/9itvA9b3nYyKZfi9+9UBrtyF2VsK2RHa8UA iPMe4/lIEs1qzGgOrYliCb8S1J3EhMBpvX1K54dRAZhxfr+cKOW7XnrWx5Sphh0y7s38 Zbmw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SXN50O1Q; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-147666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id p5-20020a63e645000000b005f751c531ecsi6007756pgj.761.2024.04.16.15.03.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 15:03:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=SXN50O1Q; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-147666-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147666-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 1E76CB21340 for ; Tue, 16 Apr 2024 22:03:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1A7E37FBA8; Tue, 16 Apr 2024 22:03:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SXN50O1Q" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E035A200D5 for ; Tue, 16 Apr 2024 22:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713305019; cv=none; b=t12/lsIqqfKyRz3v8tvpQ+wdsEHWh77SGpftXHM6e/uBJapV+4OZm4nXqA9WfWYmwna1wwqLfQMu135sqyOjH0sQUNC0UEy8q1m+1yipQPYTGC1js6tP8waCN0hiF3mP/KgnArLQkRkztVmOSu88lHUHTIMHsDumg7UdJ/cwk6U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713305019; c=relaxed/simple; bh=pgVBszKn+oJK1a+kEuPlUNLOHqXoa11Qlz/3X1dd+Pk=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=UZBDfjjg7DeJlJlzydtZ1ZDQJ1K0YbJRPLos60dG2CvIG06CGT8vXooQBNpGOrgU8oI6s65bzFnPECRWgM9OZPXgPvJdlzN+FZM45AZE9mlSQRgBDJ/XFlpUPwfhXLI3tl7BKWYchbVuOfzp8PPkx9JgvoLrgY7JoWbyqE1bt1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=SXN50O1Q; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1713305016; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0mXC6erWL5zoj0Mw8kxXnTBZ+XFTfEZhlYEfC3KPt4Q=; b=SXN50O1QT6imDSoCo7YYLXqsbqF2PMERCAsVMOvW+qM/vzxD7dwe5m7hVNAbynExAjNGRQ F1QqC/mGez6SflgYyDVAnjIYachiAX3oSnVjkRq8bMbTjdEkTG7wcsgP16t6CAGdPCezHO jTQ4d1aluvp/KCXEM2kC66QzAOie4cg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-518-4zxDV23APN2AohE6wP_0Cg-1; Tue, 16 Apr 2024 18:03:35 -0400 X-MC-Unique: 4zxDV23APN2AohE6wP_0Cg-1 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3455cbdea2cso88709f8f.0 for ; Tue, 16 Apr 2024 15:03:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713305014; x=1713909814; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0mXC6erWL5zoj0Mw8kxXnTBZ+XFTfEZhlYEfC3KPt4Q=; b=fdye4lqsY5bPntqZ7o4hP471cqCyVfJULeUrK5RWqvp9g2tzZ4U17z17S7EwsxW442 LKAbC4Un3YFEqxvJHN9leS4lXiveNcZ8PI/s3IH8HSQjlVzNIlQJkzIK0pSXJak/5FLv GM8vwOeF6P150glRwAlRlTUBdXUYifHQMsmJC1XzQzDV/QE8qWaqxUGtVy/Hn3qnaMjl mCzeKxZJ0SOQYojrFRXchhpVMJyZ86jug+CPo/5pTqWseIXEhC32uxIjajMERepKaJyZ iFmQcv7j1rex8WRZMTkKrYBdvpPIkrf1wFuKn9yU6C8FlJo/CmofOrXmDzkDx8PqtK/i tK3g== X-Forwarded-Encrypted: i=1; AJvYcCVxtSsK1xtPI7rkdVGko3IA8VHlEU/dg/76A30J3qfEza771hO/rMK/SbF5UHAUh35k9MwUXb3CE9uxWkUStejKPPDfJt4CpkOXgG8U X-Gm-Message-State: AOJu0Ywb3TnGRfUxOZJRbdksJcNiVSVkfM0nyW7KzinXuejdAefmJyRX fC/1u34p/yOK742TodlbLbP0sqduPbCFriTPMDnz6VHGaRVVbj5arfgMbEn//2eVm6SP/ID/wn7 mciuZXDeg6Z/WFI4Ppcu2uWdNpLE19bm9h7gRUsK+YN5aD0u9XIyVLq9shiQ7JjRSzIhm3P1RHR jhlsIjD7RZmRy83wBM+1pcv7CNh8xnXrwt8ooe X-Received: by 2002:adf:f304:0:b0:346:ac24:ee89 with SMTP id i4-20020adff304000000b00346ac24ee89mr416662wro.9.1713305014183; Tue, 16 Apr 2024 15:03:34 -0700 (PDT) X-Received: by 2002:adf:f304:0:b0:346:ac24:ee89 with SMTP id i4-20020adff304000000b00346ac24ee89mr416651wro.9.1713305013875; Tue, 16 Apr 2024 15:03:33 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240416204729.2541743-1-boris.ostrovsky@oracle.com> <66cc2113-3417-42d0-bf47-d707816cbb53@oracle.com> In-Reply-To: <66cc2113-3417-42d0-bf47-d707816cbb53@oracle.com> From: Paolo Bonzini Date: Wed, 17 Apr 2024 00:03:21 +0200 Message-ID: Subject: Re: [PATCH] KVM/x86: Do not clear SIPI while in SMM To: boris.ostrovsky@oracle.com Cc: kvm@vger.kernel.org, seanjc@google.com, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Tue, Apr 16, 2024 at 10:57=E2=80=AFPM wrote= : > On 4/16/24 4:53 PM, Paolo Bonzini wrote: > > On 4/16/24 22:47, Boris Ostrovsky wrote: > >> Keeping the SIPI pending avoids this scenario. > > > > This is incorrect - it's yet another ugly legacy facet of x86, but we > > have to live with it. SIPI is discarded because the code is supposed > > to retry it if needed ("INIT-SIPI-SIPI"). > > I couldn't find in the SDM/APM a definitive statement about whether SIPI > is supposed to be dropped. I think the manual is pretty consistent that SIPIs are never latched, they're only ever used in wait-for-SIPI state. > > The sender should set a flag as early as possible in the SIPI code so > > that it's clear that it was not received; and an extra SIPI is not a > > problem, it will be ignored anyway and will not cause trouble if > > there's a race. > > > > What is the reproducer for this? > > Hotplugging/unplugging cpus in a loop, especially if you oversubscribe > the guest, will get you there in 10-15 minutes. > > Typically (although I think not always) this is happening when OVMF if > trying to rendezvous and a processor is missing and is sent an extra SMI. Can you go into more detail? I wasn't even aware that OVMF's SMM supported hotplug - on real hardware I think there's extra work from the BMC to coordinate all SMIs across both existing and hotplugged packages(*) What should happen is that SMIs are blocked on the new CPUs, so that only existing CPUs answer. These restore the 0x30000 segment to prepare for the SMI on the new CPUs, and send an INIT-SIPI to start the SMI on the new CPUs. Does OVMF do anything like that? Paolo