Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1742099pxf; Fri, 26 Mar 2021 13:52:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwk8ZDvbxLG5jb1aXNMXLDg8RMtcvm5GzyNv/LUOFaANpN8EffpS5D4mvBeMOdEdoksWcgV X-Received: by 2002:a17:906:170d:: with SMTP id c13mr16858297eje.491.1616791922366; Fri, 26 Mar 2021 13:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616791922; cv=none; d=google.com; s=arc-20160816; b=n8eLs8YqkO2wYsq1MTiYxwTfyztqCndeAJa8lXNA5dZ4NtxETh+95j5wjrCPCuMJ48 U6BKBDIQNVJwDuW0jO2gCDCUR92uE8SFqwthwxc9oxjEGZj/aSYYU7R/qKPEOldBn90h RO4N3Qdr/eho1PKEfxANZOppl+jB8NVnxtScsS9f95ZVmpw8U4cxqrTsOAJdiYWck4El gOj6NMzraD6Z4Vugq6JWwjtleGSYka2ZUcCrL4cQyBR/Cm8dVDSRVRgmElpFhymhCgIP zH5LHPLeUylRekxFIt5WIw4qKc/SzICjsvkbJquXdfX6TcWfwz7BS5srlXqTpdof6XAq 8TgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Pl8JEoxvL73anIEn3voYMNjMfBW7n6bzRfzu7Zk347c=; b=zCKZOxbuUV7LCo62SsgjjgFM+nH2Ect7zzAehFQ7uIUPQjRikt+ON3NAZWngFoqHNH 32GlgGXLqTwo/1cXvt+GGFgoqEJQTH77/dQjhhrj5EpM/wB5I80d2+radslN6JYLmfVc Dny3LxczKkC6oAKrjHSrFIHqQYLmP5/mb9Is98NvhX2loRFuoHbQgCUlAqb0J8xZ2LoI kwSRTjsYowJwQ7/TYD5OhKHrRnHT53NkAzXcU5A/zVPwWu/3ewexFgMivu8zuwJ/HaDV /+aLQkGncDVSCFdC7cqRzLmXGfl+mgKZnS9LLGYnLhujYgZNxi+Nf616JeUIkNUHNXi1 VcDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=OBB3Apti; 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 w17si7657792ejk.520.2021.03.26.13.51.40; Fri, 26 Mar 2021 13:52:02 -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=@kernel.org header.s=k20201202 header.b=OBB3Apti; 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 S230107AbhCZUsj (ORCPT + 99 others); Fri, 26 Mar 2021 16:48:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:46710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230027AbhCZUsP (ORCPT ); Fri, 26 Mar 2021 16:48:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6C54461A28 for ; Fri, 26 Mar 2021 20:48:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1616791694; bh=0rMg/pE0UVImohnWe+m+usj/8tIiLJvFetfjLnR36zE=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=OBB3AptihC7dO1Ahhzn3cf74jA5caUTRwVbTE2uoowaiRHOHRC1ZA0glFIfNiUy98 J0kopjkZaMiNjHfumKk4AxOs1lT7dQfmGXTsLOpc4LlEQw/chLwN3iFoKPi9Jk4RMd FYqABJiJpwEURZmg4lBE8zcmly1uZ4FAuJwrtZZJQzLEgRW6bFavybKIWy79+a3jMa ehjlazw9yw9wTo7iWd43+9lkAtmPD7hF+R5FXZb/aPx7nDu+gecxyVEwFltUj2Dylw kctdu1ABroK78J2dwu70dir+3vwr8ddfTOSk1KLe3ZiyEnBcE54HjvmVznHCDbzEt6 4BzjMSmV+Hs0w== Received: by mail-ej1-f45.google.com with SMTP id u21so10273356ejo.13 for ; Fri, 26 Mar 2021 13:48:14 -0700 (PDT) X-Gm-Message-State: AOAM533x8ar4OYrl/lGsEgY2VyKbpwxPALiWbNyCJZIy2osJlLF2/1YF XfxYs3t1+keypgJU2A/XaXKkx4/KJcugCwMNusPAxg== X-Received: by 2002:a17:906:a896:: with SMTP id ha22mr17050353ejb.503.1616791692854; Fri, 26 Mar 2021 13:48:12 -0700 (PDT) MIME-Version: 1.0 References: <87a6qqi064.fsf@mid.deneb.enyo.de> <87blb5d7zx.fsf@mid.deneb.enyo.de> <877dltd569.fsf@mid.deneb.enyo.de> In-Reply-To: <877dltd569.fsf@mid.deneb.enyo.de> From: Andy Lutomirski Date: Fri, 26 Mar 2021 13:48:01 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: Why does glibc use AVX-512? To: Florian Weimer Cc: Andy Lutomirski , "H. J. Lu" , X86 ML , LKML , "Bae, Chang Seok" , "Carlos O'Donell" , Rich Felker , libc-alpha Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 26, 2021 at 1:35 PM Florian Weimer wrote: > > * Andy Lutomirski: > > > On Fri, Mar 26, 2021 at 12:34 PM Florian Weimer wrot= e: > >> x86: Sporadic failures in tst-cpu-features-cpuinfo > >> > > > > It's worth noting that recent microcode updates have make RTM > > considerably less likely to actually work on many parts. It's > > possible you should just disable it. :( > > Sorry, I'm not sure who should disable it. > > Let me sum up the situation: > > We have a request for a performance enhancement in glibc, so that > applications can use it on server parts where RTM actually works. > > For CPUs that support AVX-512, we may be able to meet that with a > change that uses the new 256-bit registers, t avoid the %xmm > transition penalty. (This is the easy case, hopefully=E2=80=94there shou= ldn't > be any frequency issues associated with that, and if the kernel > doesn't optimize the context switch today, that's a nonissue as well.) I would make sure that the transition penalty actually works the way you think it does. My general experience with the transition penalties is that the CPU is rather more aggressive about penalizing you than makes sense. > > For CPUs that do not support AVX-512 but support RTM (and AVX2), we > need a dynamic run-time check whether the string function is invoked > in a transaction. In that case, we need to use VZEROALL instead of > VZEROUPPER. (It's apparently too costly to issue VZEROALL > unconditionally.) So VZEROALL works in a transaction and VZEROUPPER doesn't? That's bizarre. > All this needs to work transparently without user intervention. We > cannot require firmware upgrades to fix the incorrect RTM reporting > issue (the bug I referenced). I think we can require software updates > which tell glibc when to use RTM-enabled string functions if the > dynamic selection does not work (either for performance reasons, or > because of the RTM reporting bug). > > I want to avoid a situation where one in eight processes fail to work > correctly because the CPUID checks ran on CPU 0, where RTM is reported > as available, and then we trap when executing XTEST on other CPUs. What kind of system has that problem? If RTM reports as available, then it should work in the sense of not trapping. (There is no guarantee that transactions will *ever* complete, and that part is no joke.)