Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp46921rwi; Thu, 13 Oct 2022 21:07:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM44/RdcqPnSHFVfdDy/CEDccUQHYvpgFWimNnfTRqpcc9uENEVWW3pugJCFHc9TqaCL7ARc X-Received: by 2002:a05:6402:11c9:b0:459:9f7d:6453 with SMTP id j9-20020a05640211c900b004599f7d6453mr2553017edw.372.1665720423426; Thu, 13 Oct 2022 21:07:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665720423; cv=none; d=google.com; s=arc-20160816; b=RLSRpJ1C63INS1rFPQIxFnDYCaW1jSAITzPxlFtGb+QWmwzBHcYfVJ/r61hfj5SzBb WuTyJ0YWOg365zAHhL0dQGkuMblRNqQmatFyHTryNTPevTR9Tt07yL5elKABGB7MVBts UdZ2ZBE1OnOCE1ItAwPkwAn/vhX0VeGUsLwCtXw62x768YUQrExIf24atl6nzMmQluKG o78gR7Mi5ErN9rB3PCI5wabHizQwz+s/F/PvOEw/I+QWaeKa52/nNo3+f5eCOLRavorp dqjb8H7/G+vadBkIFTENhhH0zqjhnBM87S44bCHurWXWyxP32jPeaK/NDFEb9PoZtATi QOdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:to:from; bh=kTuZ/n5dUKMGjX3X/w9qYLTVpdYAVyeBnPZ8Ed1g+FM=; b=ko4TnJCO1FRlXojVQMv8KtTZoZ3SpHZrsqT3eIDr0tnaatZvAyqK7HguRxxW/Luplr CDSIWMIBUuYo82Jh1+2uiOR3IhVk6a9ee8qTg/SGtiJzzevVR1PLHc21xLc/s98oqjF5 NUCukIbp2vxEfSisS00lW5lMCo/qFX5QnD3wlDkPCRgAQ09EQNf+SfRL//NWO0S8eDC7 yxsdvrjuoou9ECMN9hx3+UOJhwtS+rQvkRO8RFcTHZsYyA+LtCQxe4BwrUYUkovw2v1N v5fLHAuSXjxmkjvwuxelNgawNBIAC/E8i2rqBGjXNbh1PQcxCVuuO4Vp8UFb8mWpK3Vu x1fA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc6-20020a1709071c0600b007707b853e46si1398867ejc.882.2022.10.13.21.06.29; Thu, 13 Oct 2022 21:07:03 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229825AbiJNECM convert rfc822-to-8bit (ORCPT + 99 others); Fri, 14 Oct 2022 00:02:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55662 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbiJNECL (ORCPT ); Fri, 14 Oct 2022 00:02:11 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.86.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A767DED9BE for ; Thu, 13 Oct 2022 21:02:10 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-401-gxuhFJcYOv-EzyJDmGZ9AA-1; Fri, 14 Oct 2022 05:02:04 +0100 X-MC-Unique: gxuhFJcYOv-EzyJDmGZ9AA-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.38; Fri, 14 Oct 2022 05:02:03 +0100 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.040; Fri, 14 Oct 2022 05:02:03 +0100 From: David Laight To: 'Robert Elliott' , "herbert@gondor.apana.org.au" , "davem@davemloft.net" , "tim.c.chen@linux.intel.com" , "ap420073@gmail.com" , "ardb@kernel.org" , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH v2 05/19] crypto: x86/crc - limit FPU preemption Thread-Topic: [PATCH v2 05/19] crypto: x86/crc - limit FPU preemption Thread-Index: AQHY3oYZ7LB/MaiZeEeC/a2xezfdB64NQsbA Date: Fri, 14 Oct 2022 04:02:03 +0000 Message-ID: <85a029f30048495b963ae0ee0308853f@AcuMS.aculab.com> References: <20221006223151.22159-1-elliott@hpe.com> <20221012215931.3896-1-elliott@hpe.com> <20221012215931.3896-6-elliott@hpe.com> In-Reply-To: <20221012215931.3896-6-elliott@hpe.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org From: Robert Elliott > Sent: 12 October 2022 22:59 > > As done by the ECB and CBC helpers in arch/x86/crypt/ecb_cbc_helpers.h, > limit the number of bytes processed between kernel_fpu_begin() and > kernel_fpu_end() calls. > > Those functions call preempt_disable() and preempt_enable(), so > the CPU core is unavailable for scheduling while running, leading to: > rcu: INFO: rcu_preempt detected expedited stalls on CPUs/tasks: ... How long were the buffers being processed when the rcu stall was reported? It looks like you are adding kernel_fpu_end(); kernel_fpu_begin() pairs every 4096 bytes. I'd guess the crc instruction runs at 4 bytes/clock (or at least gets somewhere near that). So you are talking of few thousand clocks at most. A pci read from a device can easily take much longer than that. So I'm surprised you need to do such small buffers to avoid rcu stalls. The kernel_fpu_end(); kernel_fpu_begin() pair pair will also cost. (Maybe not as much as the first kernel_fpu_begin() ?) Some performance figures might be enlightening. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)