From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id AB1531F55B for ; Fri, 29 May 2020 16:18:21 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF3093840C2F; Fri, 29 May 2020 16:18:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF3093840C2F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1590769100; bh=F/lAYX+TV4rBwyPp5ojdr8adCyC5agCqweu6rCDMemE=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=oWktr/scTtXsJC0Db46ZlSLuahmCJPKuRv/FE5pqMnpDSiZD8TPJx0g8I+LE+dsIr qq5VIfsmC1KZy2HX3ZKimnaxO9hJeZaoBnNnoBVhQPypGGsqjzYgzKA0aJvUYzt4EZ xj9iWvfYkrz33B676cj7D3wZ3Q0JBVH7Sm3XaZPI= Received: from us-smtp-delivery-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by sourceware.org (Postfix) with ESMTP id 1D1943851C2C for ; Fri, 29 May 2020 16:18:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1D1943851C2C Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-312-CKhm-iR6OLis7MsJpDRLmg-1; Fri, 29 May 2020 12:18:16 -0400 X-MC-Unique: CKhm-iR6OLis7MsJpDRLmg-1 Received: by mail-qk1-f198.google.com with SMTP id j16so2329051qka.11 for ; Fri, 29 May 2020 09:18:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=F/lAYX+TV4rBwyPp5ojdr8adCyC5agCqweu6rCDMemE=; b=sFQd1wT9PjxxpvjgyTV6hf/eoj/OZuGVLt41ep5oRahBa2faWoVzuTgdWUK5Twag2p U679ARf7Q7kDFa9OSCk7Jozy90JWnRnwgjzbZzY2d07YeajnY8MgaQO9yF9dvBguw3T8 PjhrreGmml6kSmTu6ZrSGKDvjvcb6yE/LwibgC5bwazaPAynbyr/vIlYH8+WrjvE/5U8 L/e9dqU5TXYqiVv/mzvGIq0CRY2M4Ge6TeQngudpZmtpyC+TNlnvKZ5MGz66K0EfDUuY 2Pl7MaQYSYAGCP/wynAJ9sUbhSK3OFqDd2FolfrLGV/bN3pmVetQUJ88pFSQ56y8DpE0 qN/A== X-Gm-Message-State: AOAM530/wvsPjWsLxvki3B0/dDB/y0FyLXEuyRZiTesZVg/jnzJdbodj yuU11kRP5lj143DN9AXRPRHYH7DNY6EHYkHWCHQwq2wy+6Us7pgs7PYGpLPAo3SoHw0qBGoEjcm 9huiZCsl/6kZVHj5n8eWb X-Received: by 2002:a37:7906:: with SMTP id u6mr8467165qkc.495.1590769095481; Fri, 29 May 2020 09:18:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx/ZSxEn0VOYRQVXIqfTLhALRKaMqMuRCw2+ctV33ONq16Jsya9xXaKm4HQoKcDB9hPgZZKig== X-Received: by 2002:a37:7906:: with SMTP id u6mr8467138qkc.495.1590769095167; Fri, 29 May 2020 09:18:15 -0700 (PDT) Received: from [192.168.1.4] (198-84-170-103.cpe.teksavvy.com. [198.84.170.103]) by smtp.gmail.com with ESMTPSA id w10sm8862682qtc.15.2020.05.29.09.18.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 May 2020 09:18:14 -0700 (PDT) Subject: Re: [PATCH] x86: Add thresholds for "rep movsb/stosb" to tunables To: "H.J. Lu" References: <15ec783d-46f5-0166-aee9-f1d16a58ca83@huawei.com> Organization: Red Hat Message-ID: Date: Fri, 29 May 2020 12:18:13 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Carlos O'Donell via Libc-alpha Reply-To: Carlos O'Donell Cc: Hushiyuan , "libc-alpha@sourceware.org" Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" On 5/29/20 9:21 AM, H.J. Lu wrote: > On Fri, May 29, 2020 at 6:13 AM Carlos O'Donell wrote: >> >> On 5/23/20 12:37 AM, H.J. Lu via Libc-alpha wrote: >>> There is no single threshold value which is good for all workloads. >>> I don't think we should change REP_STOSB_THRESHOLD to 1MB. >>> On the other hand, the fixed threshold isn't flexible. Please try this >>> patch to see if you can set the threshold for your specific workload. >> >> My request here is that the manual include a documentation of what the >> minimums are for the tunable. Even an example reference of the minimum >> value would be useful for the tunable e.g. On AVX512 systems this value >> is X, on AVX systems this value is Y, on all other systems Z. >> > > The logic of thresholds are: > > /* NB: The REP MOVSB threshold must be greater than VEC_SIZE * 8. */ > unsigned int minimum_rep_movsb_threshold; > /* NB: The default REP MOVSB threshold is 2048 * (VEC_SIZE / 16). */ > unsigned int rep_movsb_threshold; > if (CPU_FEATURES_ARCH_P (cpu_features, AVX512F_Usable) > && !CPU_FEATURES_ARCH_P (cpu_features, Prefer_No_AVX512)) > { > rep_movsb_threshold = 2048 * (64 / 16); > minimum_rep_movsb_threshold = 64 * 8; > } > else if (CPU_FEATURES_ARCH_P (cpu_features, > AVX_Fast_Unaligned_Load)) > { > rep_movsb_threshold = 2048 * (32 / 16); > minimum_rep_movsb_threshold = 32 * 8; > } > else > { > rep_movsb_threshold = 2048 * (16 / 16); > minimum_rep_movsb_threshold = 16 * 8; > } > if (cpu_features->rep_movsb_threshold > minimum_rep_movsb_threshold) > __x86_rep_movsb_threshold = cpu_features->rep_movsb_threshold; > else > __x86_rep_movsb_threshold = rep_movsb_threshold; > > We can't simply say AVX512 machines will use ZMM and AVX machines > will use YMM. It depends on other factors which are invisible to users. > Can you suggest some paragraph for libc manual? We must tell the users the lower limit, so they can avoid having their settings ignored. If we can't tell them the lower limit in the manual, then we must add a way to print it. Augment the libc.so.6 main() entry point to print all tunables with a --list-tunables option and print the limit? Then in the manual just say you have to look it up? -- Cheers, Carlos.