Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1480943pxj; Fri, 21 May 2021 15:47:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwrg4+eU/jPqVB2RkPV4ZHdcEZPktl0v4MdcLrDg95qMG146lI2r2yYyQwLCFGtW7XVEcFc X-Received: by 2002:a6b:3f0a:: with SMTP id m10mr1361877ioa.120.1621637251194; Fri, 21 May 2021 15:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621637251; cv=none; d=google.com; s=arc-20160816; b=qKE4tTq5dgJfmg/BSekq1UN35X2iUSwLucz8PeFeepK3csAhjBLVqfXN5c7RokHHlX VPlWBRRjzBxvOHiFrlV0HwgudHoKB2+pUjO6/RlUhlwu8tYrhwLB5skFRAcZwln+gXU7 mLOX3OCxW4ip2edIvxFkeeb1y8+VJpkSkR/pqmEq/lRWGx8IQMp8HSP0h1XNvDnqPuui PzB/NMckgAUgcWWgaSWycwspJWHGebnMIXJp3swOoQIsZrSJBpSbO6N++irez/nhYw7b UPs8ayg1ko6yOypCXr5hbUiSVgIIDnxsjDuccqAsySObtiJW+6SeD+OF7p5LHYEh1m6h JCUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=7AL4eSbRRfrL2LByAtHmtcseyv6XL+hFBItU0efUNQY=; b=H6jj40WTl4nKS/YkaJDouOkWl1YmaCnhC/Uchi3JrIB3+0bFtPZvGwFo5d8YDNSyRL 1Fmlm6QntJHWiHCznRVvHZfgXhZog64sdaBR6BVY7Pa0gp+PJDTq8XYhg1XZu6naswhS dW+YmD+vU8de6yx5x8artoMn0q0Wg/2hygiplYUezvqruqQ5e4HbE6Wi6/lRLEKDBx9l KjQx08FRdO+J6Zdvv/IWs+F6cEfRKSzxU3MkI8Bmrma7CVDuHnj8X8ad9L6S7x5zP3x5 m+geNsgp5QAXhVgNwObFsFy8E1+0gxpYXSJVwD0HXWcodkX2mk+F1EC7GedFNcZHsBBt 2zDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=I7CGp5jn; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y19si1945041ili.67.2021.05.21.15.47.18; Fri, 21 May 2021 15:47:31 -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; dkim=pass header.i=@linutronix.de header.s=2020 header.b=I7CGp5jn; dkim=neutral (no key) header.i=@linutronix.de; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229943AbhEUWsI (ORCPT + 99 others); Fri, 21 May 2021 18:48:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41690 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229512AbhEUWsH (ORCPT ); Fri, 21 May 2021 18:48:07 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4EF0C061574; Fri, 21 May 2021 15:46:43 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621637201; 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: in-reply-to:in-reply-to:references:references; bh=7AL4eSbRRfrL2LByAtHmtcseyv6XL+hFBItU0efUNQY=; b=I7CGp5jnm8P1BsHpSC9A82tZ3cuS3c9nPvbb7LdqxvoMbVWcz5wJpDMo2A+fDOcZ8QcY4b n9HP0ua0JyAKKM6hLbphS1de1YALzyaLxqsXZHJ5S8NOUIjN6ZNP5yl+dDWswpCI/gRLPB oHKKobhOfYSodeCz7pCb81vRHnu32PyMqZbtb7zaGGebzeUzKI1L61jToCn7g7zf1eYzx6 IjbAHBLQdmXik4BMhHZyHU+uhRcFpora5hYqzjjpZy5svPICI9XQmMVB+Z4lDvi7TrPQ/f 1qPfBiTzmCDny0lMIDXEV32j3lQ/gDT9sNHi9hNr12sECZUfAA7Oux5DzZlo/A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621637201; 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: in-reply-to:in-reply-to:references:references; bh=7AL4eSbRRfrL2LByAtHmtcseyv6XL+hFBItU0efUNQY=; b=HdOFBijiOOwEnDK506NEIaS/5VjPIOMEcDj018BpkIeJ+ZK+37B1sjpxz7F+15xHPXrx8+ wM3bXyBYBeOsVuDg== To: Len Brown Cc: Andy Lutomirski , Florian Weimer , Dave Hansen , Dave Hansen via Libc-alpha , Rich Felker , Linux API , "Bae\, Chang Seok" , the arch/x86 maintainers , Linux Kernel Mailing List , Kyle Huey , Borislav Petkov , Keno Fischer , Arjan van de Ven , Willy Tarreau Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related features In-Reply-To: References: <20210415044258.GA6318@zn.tnic> <20210419141454.GE9093@zn.tnic> <20210419191539.GH9093@zn.tnic> <20210419215809.GJ9093@zn.tnic> <874kf11yoz.ffs@nanos.tec.linutronix.de> <87k0ntazyn.ffs@nanos.tec.linutronix.de> <37833625-3e6b-5d93-cc4d-26164d06a0c6@intel.com> <9c8138eb-3956-e897-ed4e-426bf6663c11@intel.com> <87pmxk87th.fsf@oldenburg.str.redhat.com> <939ec057-3851-d8fb-7b45-993fa07c4cb5@intel.com> <87r1i06ow2.fsf@oldenburg.str.redhat.com> <263a58a9-26d5-4e55-b3e1-3718baf1b81d@www.fastmail.com> <87k0nraonu.ffs@nanos.tec.linutronix.de> Date: Sat, 22 May 2021 00:46:41 +0200 Message-ID: <878s47aeni.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 21 2021 at 18:07, Len Brown wrote: > On Fri, May 21, 2021 at 3:10 PM Thomas Gleixner wrote: > Regarding pre-allocation vs on-demand allocation, consider two scenarios: > > 1. Synchronous. At process or thread start up time, prctl() > synchronously allocates 8K context switch buffers. Return code is 0 > -- good go go! 10 seconds later the program decides to create > additional threads. Woops. vmalloc failed, and the process > synchronously dies. bug filed. No. pthread_create() will fail with -ENOMEM. A return value of -ENOMEM is not a bug. If the application fails to check the error code then it's not the kernels problem and not a kernel bug either. > 2. On demand. Same scenario, except vmalloc failure upon creation of > those additional threads sends a SIGSEGV at the instruction where AMX > is touched. bug filed. > > Why ignore the 2nd bug and not ignore the 1st bug? See above. > My concern about synchronous allocation is that it will be very easy > to abuse. programs and threads can ask for buffers they will never > use. With on-demand allocation, we allocate buffers only if they are > actually needed. Programs ask for memory in various ways. The buffer is not any different than any other memory allocation of the application/thread. It's accounted for and when the limits are reached the allocation fails. But it fails in a way which can be acted upon at the application level and not in a way where the kernel has no other choice than killing the whole process. So where is the problem? Thanks, tglx