Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp704742lqb; Wed, 17 Apr 2024 08:29:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXfpZjPKfQIJ2DB3gejxxxy6KfBRYoKBISb9/ezajY77/Eq8VtK5Vrm5BAmUcGRfWSi3AoM/J3P13/qBui5IrafbfbI2SF16JLDzGmghg== X-Google-Smtp-Source: AGHT+IEg3TEJrfyJmVB/NwDrOj84V99LhfZWJEGsXzt/i5jXxnprcDoDKwGYYXInQReclq+IX9Zw X-Received: by 2002:a05:6871:54e:b0:229:f022:ef83 with SMTP id t14-20020a056871054e00b00229f022ef83mr19902763oal.43.1713367798890; Wed, 17 Apr 2024 08:29:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713367798; cv=pass; d=google.com; s=arc-20160816; b=zKqdWV/Vxy/AFC0Zfch0JflFHc2Aj3IcARJ6fxWg7HxUf9Ia/9yFrTVkNJo+UMQ0cl szp1m+T8a4wmVbuk4yuWBSfNyeBd/lAkBI8bw+OzaQ/LJsTzWjFFjjz9/MUzrBZratcr xC/bOVLWa5wUwSEWFbA6EWQ4oggCMi+idtZj/c1U+9ol8u2HoIQJoVfQig2ltp5nieIQ 6EU+vb4BjA/4FS0dXvQUjbdFfTgQTzKT5CyiKJYALucxB0XwEfMcAceLchKvODswKo93 UA2ll2JZ8loHMB7o8ofMEer2o/Syo4eLeSucql5tX75V7Ku00znysRE3sFJKMR6diWIz WNOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-filter; bh=bzaSc0LgdgSrjspfvctBl8dHDYhVXNZrN62zA+MGLIE=; fh=Y1DNamwreoSUW4ufI50PCETHTvskjeGerYReSo9pPIc=; b=qTj9xKnzIsUu8iE6KebqOSPar2I7I2rPERl7bHVcREzIPh8ec/+S9w7JOpAISG0B6L 21MML/rdxmpecbUCokjKVoZXHq5R1W/hAcZJSmosmt9hZkRI8fcUyEU/YXXcAMX2t0uA k0ijqd5EqEsVIUsfSQc2TB5SxCvaovAAOeKqFg6sXJgxzPCv40mZmKAgFtA3seF9Hpy9 DE/MlMjBSboN8BdMk/6zXvnk56sMi7m6412FfrZ83mGSyCpBjERWgBr1xwh/RGvRQLeJ rJ5RnpJWBvHKd5Dij+uJv25Csd0GxwExrN8NKitOLAGXYYinIMZzx+fLBFgiPnq7fAEX tkRg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zytor.com header.s=2024041401 header.b=dgYN7RW0; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-148757-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148757-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id l13-20020a6542cd000000b005dc48468987si11299163pgp.754.2024.04.17.08.29.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 08:29:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148757-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2024041401 header.b=dgYN7RW0; arc=pass (i=1 spf=pass spfdomain=zytor.com dkim=pass dkdomain=zytor.com dmarc=pass fromdomain=zytor.com); spf=pass (google.com: domain of linux-kernel+bounces-148757-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148757-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.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 9F0AEB2650B for ; Wed, 17 Apr 2024 15:07:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63216146A8E; Wed, 17 Apr 2024 15:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=zytor.com header.i=@zytor.com header.b="dgYN7RW0" Received: from mail.zytor.com (terminus.zytor.com [198.137.202.136]) (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 44A4713C3EF for ; Wed, 17 Apr 2024 15:07:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.136 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366462; cv=none; b=PZSmVw28Z4qOaG3fet8uHBkztM7OCIkzev5hkhxwgJPBf3JvaPctN1u5S/rRoFfJAyi+jSeJraP/Q40Jcxa3DBwzmi616LWCEGk2vIPsW0p6+bCjgVHyuX2iA+p0vAAAarA5ppRp68ghoPquGod6Acc4p+eL8xTQ8BTGXFEnYXE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713366462; c=relaxed/simple; bh=GJjCHKH2dsSjH1IMoMJgT+gbrbyzNcXL6q46u4gzC3s=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=CvrWVy4+dlNWcmlSqVxPFvBibP6cmucVxNavt/g0pa7G2tLKSLmPqA8smOt+aTv74cZaPjLDLQHEhEcmKqurHloi6o2ZbyqpZnq4LpgQdJ4kZ16xlreZDpLNTdKN7sbcacMjYvI2QXzgcNFz/rGBAvmS9GGJn5kOQgFjRnfAt24= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com; spf=pass smtp.mailfrom=zytor.com; dkim=pass (2048-bit key) header.d=zytor.com header.i=@zytor.com header.b=dgYN7RW0; arc=none smtp.client-ip=198.137.202.136 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zytor.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zytor.com Received: from [IPV6:2601:646:8002:4640:7285:c2ff:fefb:fd4] ([IPv6:2601:646:8002:4640:7285:c2ff:fefb:fd4]) (authenticated bits=0) by mail.zytor.com (8.17.2/8.17.1) with ESMTPSA id 43HF7MGM4069601 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NO); Wed, 17 Apr 2024 08:07:22 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 43HF7MGM4069601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2024041401; t=1713366443; bh=bzaSc0LgdgSrjspfvctBl8dHDYhVXNZrN62zA+MGLIE=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=dgYN7RW0lRY301XtdtT2SislSlceJ3oGEasNzgz6E+iUyOjqJ6EVeo+r8ui8V5RI9 qYq2kOzgAC9CHqb5VdJKqY6Omhk1LDqFxDLr1astDQZDbBnRJ2wl5Ciztnip6pKQHA 3tJulyTDa3F8dJ7YjoEknT7EGcdBKkQG1HnMGCqN9Yfm6JDpS2ReSZlpJITZmzVJhV otTtiEdTs9A+FNi6Pjc2jDtqZAQdqCCCTov3fBqlCgFBNwvRLbq2PJv5nmm1WJ9q6K meoOMVyGGgU100B6Cg4rxucmMc7BbKQBSf6MaUYyFu6qR3CoZGS3F/Q/hHb4eqVQ62 MyQ7R6Q4lpbAw== Message-ID: <2d0e67dd-c3e3-4701-839a-68d73c61c170@zytor.com> Date: Wed, 17 Apr 2024 08:07:16 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/1] x86/fred: Fix INT80 emulation for FRED Content-Language: en-US To: Nikolay Borisov , "Xin Li (Intel)" , linux-kernel@vger.kernel.org Cc: luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org References: <20240417063001.3773507-1-xin@zytor.com> From: "H. Peter Anvin" In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 4/17/24 04:02, Nikolay Borisov wrote: > > On 17.04.24 г. 9:30 ч., Xin Li (Intel) wrote: >> Add a FRED-specific INT80 handler fred_int80_emulation(): >> >> 1) As INT instructions and hardware interrupts are separate event >>     types, FRED does not preclude the use of vector 0x80 for external >>     interrupts. As a result the FRED setup code does *NOT* reserve >>     vector 0x80 and calling int80_is_external() is not merely >>     suboptimal but actively incorrect: it could cause a system call >>     to be incorrectly ignored. >> >> 2) fred_int80_emulation(), only called for handling vector 0x80 of >>     event type EVENT_TYPE_SWINT, will NEVER be called to handle any >>     external interrupt (event type EVENT_TYPE_EXTINT). >> >> 3) The FRED kernel entry handler does *NOT* dispatch INT instructions, >>     which is of event type EVENT_TYPE_SWINT, so compared with >>     do_int80_emulation(), there is no need to do any user mode check. >> >> 4) int80_emulation() does a CLEAR_BRANCH_HISTORY, which is likely >> >     overkill for new x86 CPU implementations that support FRED. > > Well, that's a bit of an overstatement/speculation, because > clear_branch_history will only be effective if the machine is > susceptible to the given bug and there isn't a better options (i.e using > a hardware bit controlling the respective aspect of the CPU). >> It would seem like a huge stretch to expect that a FRED-capable CPU would not have such a facility. This is a matter of establishing a baseline for FRED-capable hardware. It would make more sense to me to add it if we turn out to need it; note that FRED code is currently only enabled on demand, in order to defend against bit rot until we have physical hardware. Now, if this is still desired, it *probably* belongs better in either fred_intx()/fred_other() or asm_fred_entrypoint_user, depending on if this ought to be done for all entries from userspace or only system calls. -hpa