Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3748790pxv; Mon, 19 Jul 2021 07:53:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwb/21Wd5l0QrAh5HA57oDJVfpouBBqTkdesb3bURe1+HW67arVg5KYvOCrW647AcjjGmKG X-Received: by 2002:a17:906:3006:: with SMTP id 6mr28245762ejz.73.1626706404209; Mon, 19 Jul 2021 07:53:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626706404; cv=none; d=google.com; s=arc-20160816; b=BrqfXA4Rmu8FGLUDUXIrcNOvbsIg35w6OjnAJ3FvJyL+yS96zmFeXn40uOGQCOdOvf 6GjJGufnhNFtsIg2MGyeXG66SQQvqVT9Bv3m5gS0qrtxGv+w622gWJEM3MIGMiz5aWHV CGQhw/b70ho9EsgqQqiHCA8O9mHu9yC02N81Yxz4ciPn+RLm9hRt9r80cobkkH7EOwlG 861CdD+5ZLAvKujBL3KLU4bZOLhMIdi+0Q2wmm7hZ9bugQLmcCblMgaxVBY10EUtSN9d v5kEDgJnDSBDEmrCYaIhhEkbToRL5d3ml04qRDBwnSizYDNeKtbx8ZZKULsUfXc+4zjV 96Yg== 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; bh=h0F6zaWYo/2gEeB9FyUDTUvQFefAHDl6PCqoSJtHPoY=; b=xjjY0xz5aKFqMZgGJ49ipZBPOBd8dvqFdqSiwaoh7cI5Hp2cfq6XIlMRVrlNQQuBAz DX6Cr1UaifQN+YAuim5rTQhv4Sn+KBFcgW8G6em6GZE2bHge+/pA0MjT7x+rHCpsN+CR jYoIaAgpNspYIG72jjSd5w8tfDvhJXbLTeW/MpSuy0VyZujFKxvwt8/8GugjNQ/ehG9O efg19o/CZbzLITj4AIn79/XLcmgaPsm/G+Ttv0M9a4Lb7CdgqQqpQw5vK+SU+ATWr19q hDH/KenuzVEmJhZLZGOqRu4tlPOF3UfUlQu7lQlbO2eTUPE7F5CI2Y+1lIgZLgC3nOzT gTXg== 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 b13si21792937ede.452.2021.07.19.07.53.01; Mon, 19 Jul 2021 07:53:24 -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 S241156AbhGSOLT convert rfc822-to-8bit (ORCPT + 99 others); Mon, 19 Jul 2021 10:11:19 -0400 Received: from mail-vs1-f53.google.com ([209.85.217.53]:46682 "EHLO mail-vs1-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241182AbhGSOJO (ORCPT ); Mon, 19 Jul 2021 10:09:14 -0400 Received: by mail-vs1-f53.google.com with SMTP id e9so9459900vsk.13 for ; Mon, 19 Jul 2021 07:49:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=Qx5mJkBsGELHIfg3tO6IBHVeQdtURYJ38KZzvX6xUBY=; b=GTNIkkMT1/aroOpzSfHfqRdsuj2GeI1yQlIRXxjJq2glfJ/o7PEkkNvwUX7Iq45L1I QOFyv7dNEryXiKOWOZIW7Ye4NB2Ds+nhOItWv1CsF86VHKDjw0zodVQaBTj/BcGFJT6B pfYEBTO2MAUrSVWm1kgtbCxe8LZPk3Q5RYgWLqfEH7+eJmGnz21LAYp2r6INoVJ4zJ12 uMtWRAphd76GPOgXWz3dlu1xlJOhZEDJJ5h93tr+WQNNzUGAuoyIJ9EvFXeg//dMjw6Z oju//bDRv+9QVZxYMVqQMWc/0Gy2c2dm38Z52tXeIcELO8xoQKo50VyNEF+/ecFAk+Ye dz9w== X-Gm-Message-State: AOAM531/IwtrEo3YvZMKqYRqMzfxa/QDx/ttMrOBnW3uR1ImHWB3Gao4 Hw6hcf5TKrnazj5fFvQpGLT02AlUWEL2Hn/W4ao= X-Received: by 2002:a05:6102:321c:: with SMTP id r28mr24683436vsf.40.1626706162788; Mon, 19 Jul 2021 07:49:22 -0700 (PDT) MIME-Version: 1.0 References: <5e1b5d90-5a1e-5e9f-7b92-6c53b8589c2a@gmail.com> In-Reply-To: <5e1b5d90-5a1e-5e9f-7b92-6c53b8589c2a@gmail.com> From: Geert Uytterhoeven Date: Mon, 19 Jul 2021 16:49:11 +0200 Message-ID: Subject: Re: [PATCH v4 1/1] riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall To: Akira Tsukamoto Cc: Palmer Dabbelt , Guenter Roeck , Qiu Wenbo , Paul Walmsley , Albert Ou , linux-riscv , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Tsukamoto-san, On Mon, Jul 19, 2021 at 2:53 PM Akira Tsukamoto wrote: > This patch will reduce cpu usage dramatically in kernel space especially > for application which use sys-call with large buffer size, such as > network applications. The main reason behind this is that every > unaligned memory access will raise exceptions and switch between s-mode > and m-mode causing large overhead. [...] > Signed-off-by: Akira Tsukamoto Thanks for your patch! As v3 is part of v5.14-rc1, all fixes and improvements need to be send as incremental patches. After reverting ca6eaaa210deec0e ("riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall") and applying v4, booting linux-on-litex-vexriscv still fails, but now differently (real crash): /bi�����V�F-: applet not found 2'�����t: applet not found Kernel panic - not syncing: Attempted to kill init! exitcode=0x00007f00 CPU: 0 PID: 1 Comm: init Not tainted 5.14.0-rc2-orangecrab-01933-g5c9574869017 #357 Call Trace: Unable to handle kernel NULL pointer dereference at virtual address 00000af0 Oops [#1] CPU: 0 PID: 1 Comm: init Not tainted 5.14.0-rc2-orangecrab-01933-g5c9574869017 #357 epc : walk_stackframe+0x11c/0x13c ra : dump_backtrace+0x2c/0x3c epc : c0003970 ra : c00039bc sp : c1835e20 gp : c06a7690 tp : c1838000 t0 : 00000000 t1 : 00000000 t2 : 00000000 s0 : c1835e50 s1 : c05d8180 a0 : 00001000 a1 : 00000000 a2 : c04dfd68 a3 : c05d8180 a4 : ab1d4cdc a5 : 00001000 a6 : c067d204 a7 : ffffefff s2 : 00000000 s3 : c05cc9f4 s4 : 00000000 s5 : c05d8180 s6 : c04dfd68 s7 : 00000001 s8 : 00000000 s9 : 95b6f158 s10: 00000000 s11: 00000001 t3 : 00000000 t4 : 00000001 t5 : 00000000 t6 : 00000000 status: 00000100 badaddr: 00000af0 cause: 0000000d [] walk_stackframe+0x11c/0x13c [] dump_backtrace+0x2c/0x3c [] show_stack+0x44/0x5c [] dump_stack_lvl+0x2c/0x40 [] dump_stack+0x1c/0x2c [] panic+0x13c/0x330 [] do_exit+0x830/0x8b8 [] do_group_exit+0x40/0xac [] __wake_up_parent+0x0/0x34 [] ret_from_syscall+0x0/0x4 ---[ end trace d147f0f146982b08 ]--- note: init[1] exited with preempt_count 1 Fixing recursive fault but reboot is needed! Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds