Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3731409pxf; Mon, 29 Mar 2021 09:51:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwVyfd3PuzMF+7UJdfW/lUsKCMLSKBltu66m3EnnB1nTgysnQ/VWvpQrp1CDQ9wyr23CwY X-Received: by 2002:a17:906:4bce:: with SMTP id x14mr28637216ejv.383.1617036708783; Mon, 29 Mar 2021 09:51:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617036708; cv=none; d=google.com; s=arc-20160816; b=UcLY0nbJQwEgsnHIqa6vESDF3S1tzr5fPPJU2kr7XfjPYkudBwiNlowKG6X2mzIgvT lEx0QGY0jzu0mMembEATUfjISQ1OzgE6EWZr56+yoQhuhpr+MqEElp6v96smytpxJ1M2 c86i9DSpUFlpeKug/pax3RJdDazyYQYzs/LTrigkpFSgzDgg69NlmOnrDV98YL7OkoDf JgtEwBBxk8Dm9IP4ape1DP2puFmRNwgnV6jlPhyjJaUTGlAMflB277nOKWc+6ZB/bpbh /BUBN4T9sO1HTInykHXeb9zfBDnSiSnK7KdMzO690NCYVPVWGF/kZe4rk8kDW1Ek2Yvb T4jg== 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:in-reply-to:date :references:subject:cc:to:from; bh=VVQBXVQ8QGvjAEzN4pPA+4txey7ULefXi5W7V1YpNqM=; b=l/EXH3wrfyVjrUcpfZkLsy3vTq3Ryzcq05epmNDsOJq8AK6nsX3dNLOIbmkD2JVeVx GeRxlE7cT6vLGd8UAnhFtH6PANDdCX0InKQ/u/MWmwAC3YSFdCyK7YfRHnY8Sunua+Cy /uUWWcsnNvAs9h/pRYSPr/6BZ3x3ofs7jEqM61uztguUfrym6xOOSu89JTHsJy6kUJ/J CTWACZ3wYIg+yzcvTYebXqBofDec7chNTHLahp6W6Kxoo5D+H658cHIFpZeqR7FpkUmZ J2B+s6kptIBCQ4QAgphbqox5hp88QkUxm5YhZYfw3lfgmL2FKWQjcD4EjO4V4v1VZcur zQLA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si7227364edw.429.2021.03.29.09.51.26; Mon, 29 Mar 2021 09:51:48 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230399AbhC2Qsa (ORCPT + 99 others); Mon, 29 Mar 2021 12:48:30 -0400 Received: from albireo.enyo.de ([37.24.231.21]:45770 "EHLO albireo.enyo.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbhC2QsR (ORCPT ); Mon, 29 Mar 2021 12:48:17 -0400 Received: from [172.17.203.2] (port=58345 helo=deneb.enyo.de) by albireo.enyo.de ([172.17.140.2]) with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) id 1lQv3d-0006Ik-Dr; Mon, 29 Mar 2021 16:48:05 +0000 Received: from fw by deneb.enyo.de with local (Exim 4.92) (envelope-from ) id 1lQv3d-000688-9F; Mon, 29 Mar 2021 18:48:05 +0200 From: Florian Weimer To: Len Brown via Libc-alpha Cc: Greg KH , Len Brown , Rich Felker , Linux API , "Bae\, Chang Seok" , X86 ML , LKML , Dave Hansen , Kyle Huey , Andy Lutomirski , Keno Fischer Subject: Re: Candidate Linux ABI for Intel AMX and hypothetical new related features References: Date: Mon, 29 Mar 2021 18:48:05 +0200 In-Reply-To: (Len Brown via Libc-alpha's message of "Mon, 29 Mar 2021 12:38:59 -0400") Message-ID: <87eefxucsa.fsf@mid.deneb.enyo.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Len Brown via Libc-alpha: >> In particular, the library may use instructions that main() doesn't know exist. > > And so I'll ask my question another way. > > How is it okay to change the value of XCR0 during the run time of a > program? > > I submit that it is not, and that is a deal-killer for a > request/release API. > > eg. main() doesn't know that the math library wants to use AMX, and > neither does the threading library. So main() doesn't know to call > the API before either library is invoked. The threading library > starts up and creates user-space threads based on the initial value > from XCR0. Then the math library calls the API, which adds bits to > XCRO, and then the user-space context switch in the threading > library corrupts data because the new XCR0 size doesn't match the > initial size. I agree that this doesn't quite work. (Today, it's not the thread library, but the glibc dynamic loader trampoline.) I disagree that CPU feature enablement has been a failure. I think we are pretty good at enabling new CPU features on older operating systems, not just bleeding edge mainline kernels. Part of that is that anything but the kernel stays out of the way, and most features are available directly via inline assembly (you can even use .byte hacks if you want). There is no need to switch to new userspace libraries, compile out-of-tree kernel drivers that have specific firmware requirements, and so on. If the operations that need a huge context can be made idempotent, with periodic checkpoints, it might be possible to avoid saving the context completely by some rseq-like construct.