Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp10491694pxu; Wed, 30 Dec 2020 04:21:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJxy0NvNo3Ge+wigPp3d3vH31O6lMUU05UfyDRNPCTKWjS9t/XjFm/yIl6ihFj8ddCZCwnxf X-Received: by 2002:aa7:db01:: with SMTP id t1mr50093493eds.185.1609330905448; Wed, 30 Dec 2020 04:21:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609330905; cv=none; d=google.com; s=arc-20160816; b=uUcSsV7r7tagdSAuXXK7VIigwsnSdzMk8mRTZWIl4Aa7bNDbsSLynFs4GA7oftVDdP ACEzdOry2hGpiA2jKJC7QRVoex7RgPsXFS1iOUVdmYBh8c2ArpEokUvMH/2rYrtGoq5I NEajxuRHQ1uE61mjIc5qMhJnep+QhR0yEAcIVrCLrM7PmlZNRSnQqE1j2Eb5mxQjo2uT oeRBpsdg4zRqvhHQAAsMNtuMFsywVeaJAonvDd6e2y6QN3KQDFbiGoHwrl1fnQ3KeMRk Qy3kTw4vK0ofhPBMPZiXh7tQSHysQyVJ3Mmq/uo+dFBD8X2RjeWJgvtiy2smcUxrkZXn lf/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:message-id:date:to:from:subject; bh=hHjrN3iuCZP8DOqr+wutrbJz0ZpWnOsDom59eHRaGLw=; b=XMExWjD/Okd+wkMdcdjbKfDkyFHL+noWScxvpsxAvyFH/78w2i5Vz2cQNeMsOGVNCd YUGFrP4XR+/U5C6temTltVjjCT95uP79pY5wJ9wir1pmM6lgYyGs61S4BJscEJd+y26B ScGhw+IiwEUuht+aJUAef6RTld3mADaj1X+1l7as0yuWK1rHEbakI8OERXGVxIyuV/Nj qFXVR10Lz02XIgBZZ3z8i1b/a720Ok2lQv8jrUWjs7+vnXSB3fcbNWvEklvjSOOtcK4Z ndyVwWEd+3/M16SElGQlVRcnkwTvIpy2/CpDoShyxzfji4paaYue4YDjBjKvrhN+KmX+ yXdQ== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x22si21875066ejj.576.2020.12.30.04.21.23; Wed, 30 Dec 2020 04:21:45 -0800 (PST) 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726605AbgL3MTF (ORCPT + 99 others); Wed, 30 Dec 2020 07:19:05 -0500 Received: from relay.sw.ru ([185.231.240.75]:40288 "EHLO relay3.sw.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726203AbgL3MTE (ORCPT ); Wed, 30 Dec 2020 07:19:04 -0500 Received: from [192.168.15.77] (helo=localhost.localdomain) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kuaPt-00EufO-5p; Wed, 30 Dec 2020 15:17:25 +0300 Subject: [PATCH] crypto: Fix divide error in do_xor_speed() From: Kirill Tkhai To: herbert@gondor.apana.org.au, davem@davemloft.net, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, ktkhai@virtuozzo.com Date: Wed, 30 Dec 2020 15:17:35 +0300 Message-ID: <160933061716.928967.463919628731790218.stgit@localhost.localdomain> User-Agent: StGit/0.19 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Latest (but not only latest) linux-next panics with divide error on my QEMU setup. The patch at the bottom of this message fixes the problem. xor: measuring software checksum speed divide error: 0000 [#1] PREEMPT SMP KASAN PREEMPT SMP KASAN CPU: 3 PID: 1 Comm: swapper/0 Not tainted 5.10.0-next-20201223+ #2177 RIP: 0010:do_xor_speed+0xbb/0xf3 Code: 41 ff cc 75 b5 bf 01 00 00 00 e8 3d 23 8b fe 65 8b 05 f6 49 83 7d 85 c0 75 05 e8 84 70 81 fe b8 00 00 50 c3 31 d2 48 8d 7b 10 f5 41 89 c4 e8 58 07 a2 fe 44 89 63 10 48 8d 7b 08 e8 cb 07 a2 RSP: 0000:ffff888100137dc8 EFLAGS: 00010246 RAX: 00000000c3500000 RBX: ffffffff823f0160 RCX: 0000000000000000 RDX: 0000000000000000 RSI: 0000000000000808 RDI: ffffffff823f0170 RBP: 0000000000000000 R08: ffffffff8109c50f R09: ffffffff824bb6f7 R10: fffffbfff04976de R11: 0000000000000001 R12: 0000000000000000 R13: ffff888101997000 R14: ffff888101994000 R15: ffffffff823f0178 FS: 0000000000000000(0000) GS:ffff8881f7780000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 000000000220e000 CR4: 00000000000006a0 Call Trace: calibrate_xor_blocks+0x13c/0x1c4 ? do_xor_speed+0xf3/0xf3 do_one_initcall+0xc1/0x1b7 ? start_kernel+0x373/0x373 ? unpoison_range+0x3a/0x60 kernel_init_freeable+0x1dd/0x238 ? rest_init+0xc6/0xc6 kernel_init+0x8/0x10a ret_from_fork+0x1f/0x30 ---[ end trace 5bd3c1d0b77772da ]--- Signed-off-by: Kirill Tkhai --- crypto/xor.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crypto/xor.c b/crypto/xor.c index eacbf4f93990..8f899f898ec9 100644 --- a/crypto/xor.c +++ b/crypto/xor.c @@ -107,6 +107,8 @@ do_xor_speed(struct xor_block_template *tmpl, void *b1, void *b2) preempt_enable(); // bytes/ns == GB/s, multiply by 1000 to get MB/s [not MiB/s] + if (!min) + min = 1; speed = (1000 * REPS * BENCH_SIZE) / (unsigned int)ktime_to_ns(min); tmpl->speed = speed;