Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp63278pxb; Tue, 31 Aug 2021 15:09:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrk6emuDYZnt34AFyFl5JMXTp93mFxOUoCF0g2r8xwGMP1VDQYLopfnBj10Us3xK4Sv897 X-Received: by 2002:a50:d68e:: with SMTP id r14mr32611359edi.136.1630447787746; Tue, 31 Aug 2021 15:09:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630447787; cv=none; d=google.com; s=arc-20160816; b=W+GauOjKEfwwzfD2B7k1cmNXqYVrRuF341eWjJElsYC0RPgw8vBZ9qs5wJ9ZoZnPpz LHCRBsYm2wckLJVLic3EnPlSUyHzTjH73vFUWwYF2hISk5AwDq4hJFqZoAY5DN11pLAn d9UhB6Q+RUqRCjT17rcmBp+ioeOfzLUzX3BXJXjOCt12mLp4xyT3rXzdFAnyD/rvaAPE gKhCfFAnp8+onqnBcbyKPT4fo0uc5RoVZaMK5u2NP4MKafBUloiFLVIhe/BQ+oi97/7O 7FLPiIp2GLVz7uCOGFme9AIihqulWvWvXtkeub1W6pRLoDJIY36zCJRnOdH1ulXAcS5y MgvA== 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=iiqDg2IJazrjCZh7knpESd4lYmfxjk4NhNOmIuXSw2o=; b=GaSju4v0YjOh1Bk9TZjIfuVv1n0htcM5zGkNJhsKlrwxnSBXVkUK4fV4TGLcoNL8aL g4XVU5N0IncwUsDkQLuF9HnFA891cz4C3vB+vx2BXa6i21/rGEt5f1HZMxLaF1oQzVfH dNwg+Se/umeaYNR8ruxQFr4jH3CpC0JE4HaEfZ32cvRVFMU+yQIbHBK/WGqXHaYFUyFR 1AlbWe4WS/7CDlOPlQUSP6wA4ODE8LogC+vBQvVX+ugK/Q8t6H5a1tfo7uVLJS9TuIFl 1IV4Fc0zc7yIi7w13/LIDaws3ghHejaCgCKDmTTCkFvXWCSIeEqCf69JdQptzygZqifl O//A== 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 b4si7696065edx.499.2021.08.31.15.09.23; Tue, 31 Aug 2021 15:09:47 -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 S240063AbhHaWIb (ORCPT + 99 others); Tue, 31 Aug 2021 18:08:31 -0400 Received: from mail-ed1-f48.google.com ([209.85.208.48]:37554 "EHLO mail-ed1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230085AbhHaWIb (ORCPT ); Tue, 31 Aug 2021 18:08:31 -0400 Received: by mail-ed1-f48.google.com with SMTP id g21so802124edw.4 for ; Tue, 31 Aug 2021 15:07:35 -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=iiqDg2IJazrjCZh7knpESd4lYmfxjk4NhNOmIuXSw2o=; b=Jo6kUNyzYOHivRN1EehQkSk1wmBEbZyOenZ685x4TMKRB+pwcqUkha0PZyaTR0aMy/ RkzHJDQpVM4LjRH3eSbuB5u6ifpu16PnL0Fn1EkL4UASFUixH6W/QNfaP4V2tQu0Xnvj mvFJMoz4KeZNsnlI3PAs+pEtGkQpv5goF/1+jLbZw3Wgx2aVDRAZ4mk0bUEEQb7FSr2Q UqKfbqnd2+ojFDV/7RbMkQzq7N2gQrS6IxaaHYrktFMboXoet7aS0kcEvobOfPmVA5A1 czLlXAyES1WXYuAg7GaLD0Bara6al0poGdXwmGLYmUPntMI1ZVfOBMVNyFRcBwZXny/E LZTA== X-Gm-Message-State: AOAM533PNBKsKLqHsKevJySmCmunm6lu/yTges5RH2OewlYGddMF8qoj Cy2QNByCBRVhPMGsEalhbmNWZSTTMAsFkvu3Tus= X-Received: by 2002:a05:6402:445:: with SMTP id p5mr32307788edw.208.1630447654736; Tue, 31 Aug 2021 15:07:34 -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:07:23 -0400 Message-ID: Subject: Re: [PATCH v9 12/26] x86/fpu/xstate: Use feature disable (XFD) to protect dynamic user state To: Borislav Petkov Cc: "Chang S. Bae" , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , X86 ML , "Brown, Len" , Dave Hansen , 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 Mon, Aug 30, 2021 at 1:52 PM Borislav Petkov wrote: > Well, if you preallocate everything... Nothing prevents, say, a pthread_create() or anything else where the kernel consumes memory on behalf of a process from failing at run-time... AMX does not add a unique OOM risk here. > > The advantage of the #NM over the syscall is that the programmer > > doesn't actually have to do anything. Also, transparently allocated > > buffers offer a theoretical benefit that a program may have many > > threads, but only a few may actually touch AMX, and so there is > > savings to be had by allocating buffers only for the threads that > > actually use the buffers. > > The program already asked the kernel whether it can use AMX - it can > allocate the buffers for the threads too. The result is that if one thread in a 1,000 task process requests and touches AMX, the kernel would allocate 8MB, instead of 8KB of context switch buffers for that process, no? Len Brown, Intel Open Source Technology Center