Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp70422pxb; Tue, 31 Aug 2021 15:20:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJ1wB8AFjYMJrsJ8EUXN/X+0jom0RN6xUeX1Hcy5B7uadFjbzJChRXKFQK5vg532UKc0Wl X-Received: by 2002:a50:ab42:: with SMTP id t2mr30152565edc.113.1630448434534; Tue, 31 Aug 2021 15:20:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630448434; cv=none; d=google.com; s=arc-20160816; b=rZ5oFbWY1TXz2Gp0WPJ8nT0NoKRBo0+xsqAhWghdfdaZykhH4MMV1kX5PYXtt4eWeQ VyPCJCJ4HE19vbORHbN7+f7iIsFvGeQzhD1iQlcVzKA4AQl2hSpemRFYuOj6kIiLe+5Y 65iyqEnPJKweNo6ThZooxbjn4MMr1vN8ToEMb6SohBOmtAZXt+wiGkHEyyKq/3m2Q+FE tQFThdfI0nO2saA6dRsOuc7hQbDv9EVq9aCIQhXiaksZPbOYcFFul10RdFNH7obYM8mD 89/Wf79ayj6KTjpCUNXPILkP/WT7J9sa2kRcyhZZkwFrRRlVYLkoxt5sichrPkp4D8+d mRnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=t4B5jdyViI96DN84wW84Y3euEgDpX1hvP6eo+cVDlPQ=; b=Mx1n2pW2rqr6Wp846ddcMXo1cgZGHqKxa/Edzub8EWmbF0NTrE0iwy0rrgTMNT2dAS xxi9EjUmA7a561akaj5qT1Np/PnVvfgTVPKzuqP3R4a9lUhRFomUN/SVW3zyHcu4A3Li Wj16GVdbGH4UAkVMFdks9Nu/3mGoCBiN48+5/V9zr106cDN9JFqs1m2LIOzBarDeZmBq p9SpcO2eFQq7HpdegTU25EgUkK5Z+WL6/2zOHDnfuDoF3kbrxABGYHzfdSZdoLVenWvh 5Ehk3w/+3nsr/o/v2nENns0W1UnQqGf1JTZzu/1P/Q6YzyV7+9/1OD031ig4DA9o4QoM Sr+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z15si22360068ejr.724.2021.08.31.15.20.04; Tue, 31 Aug 2021 15:20:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240780AbhHaWR4 (ORCPT + 99 others); Tue, 31 Aug 2021 18:17:56 -0400 Received: from mail-ed1-f51.google.com ([209.85.208.51]:37676 "EHLO mail-ed1-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230286AbhHaWR4 (ORCPT ); Tue, 31 Aug 2021 18:17:56 -0400 Received: by mail-ed1-f51.google.com with SMTP id g21so833220edw.4 for ; Tue, 31 Aug 2021 15:17:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=t4B5jdyViI96DN84wW84Y3euEgDpX1hvP6eo+cVDlPQ=; b=ki5d3W3Sib90k/JXlO7lTtluLI5lWLYpgrPyk/Duoc6UD+/EII1bbF2ddBeo/vBytF 5aPmKXiGgOu0nHmsULDXAEfQByMYC4FrajJouM9e6dP9iYSr7qvX/gymCKS5mx1WYMUf KPfSQksGYGiGLbV+vBe3BQayZkXMVuP0oP7GW6zB6KALnwT63wCbFA+V8RhdN+6zsHh7 DCaDjIrsWIPZ6UwA4NNzrt7DJSuK+giM3oU7NgCz5lEL0zOUhphti8LNr+KGhrxrmnFy 8RoliyNjlxTWIq9qq9m/z6DpfTF3n4AlEERQoqvhzwtHu45Ai6DKxdPrB56iOjgG8dB2 qUnA== X-Gm-Message-State: AOAM532MMxu3JJPHWdnx5IqyqGmeh6WAJ38kFSB6hLg48+l/Qamm/yMF 7nFYfBAXJVI1UtfX/yf/od6SjkOlGEu+ETr9Sik= X-Received: by 2002:aa7:d681:: with SMTP id d1mr32521163edr.186.1630448219630; Tue, 31 Aug 2021 15:16:59 -0700 (PDT) MIME-Version: 1.0 References: <20210730145957.7927-1-chang.seok.bae@intel.com> <20210730145957.7927-13-chang.seok.bae@intel.com> In-Reply-To: From: Len Brown Date: Tue, 31 Aug 2021 18:16:48 -0400 Message-ID: Subject: Re: [PATCH v9 12/26] x86/fpu/xstate: Use feature disable (XFD) to protect dynamic user state To: Dave Hansen Cc: Borislav Petkov , "Chang S. Bae" , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , X86 ML , "Brown, Len" , Thiago Macieira , "Liu, Jing2" , "Ravi V. Shankar" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 31, 2021 at 6:15 PM Len Brown wrote: > > On Mon, Aug 30, 2021 at 2:04 PM Dave Hansen wrote: > > > > On 8/24/21 4:17 PM, Len Brown wrote: > > > Even if your AMX thread pool threads were to invoke this system call > > > as soon as possible... > > > What is to say that the thread pool is created only at a time when memory > > > is available? A thread could be created 24 hours into program execution > > > under OOM conditions and this system call will return ENOMEM, and your program > > > will in all likelihood throw up its arms and exit at the exact same place > > > it would exit for transparently allocated buffers. > > > > I tried this exact line of reasoning with Thomas: it doesn't matter > > where we run out of memory, we still need the same memory and we're > > screwed either way. > > > > However, Thomas expressed a clear preference for ABIs which return > > memory failures explicitly at syscalls versus implicit failures which > > can happen on random instructions. > > > > One might say that the odds of checking for and handling a NULL value > > (or ENOMEM) are the same as installing a signal handler. *But*, it's > > infinitely easier to unroll state and recover from a NULL than it is to > > handle it from within a signal handler. In other words, the explicit > > ones *encourage* better programming. > > I agree. > Indeed, I believe that there is universal agreement that a synchronous > return code > from a system call is a far superior programming model than decoding > the location of a failure in a system call. (no, the IP isn't random -- it is decoding the location of the failure in a *signal hander* > always the 1st instruction in that thread to touch a TMM register). > > > I'd prefer removing the demand-driven allocation at this point. > > Adding a pre-allocate system call that can gracefully fail > (even though it never will) is independent from removing > demand-driver allocation. I would leave this to application > developers. Honestly, the kernel shouldn't care. > > -- > Len Brown, Intel Open Source Technology Center -- Len Brown, Intel Open Source Technology Center