Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3748610pxv; Mon, 19 Jul 2021 07:53:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpdB1HBimXerYu7j7QMapRMZLXEdeD6jgxA5yrevm4XLZ1BWYk+dacrZU5fHSIhQQmFBq6 X-Received: by 2002:a92:d083:: with SMTP id h3mr17591889ilh.157.1626706384777; Mon, 19 Jul 2021 07:53:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626706384; cv=none; d=google.com; s=arc-20160816; b=WxnUjzu8MLlv7UB+SfALT4YImS3kChbyO3v3462tSnWoSiyKouD9U9N5EjyXZTjyG/ R+5Qjn1vdvdVFwGTXdwdDHLwUVW6Qwi7Pe3oa6RIg7BmAkjT5cDvf4VPDX4MlpEiivQq eyIxDjP3wgSj0+SUVLz+3Ihy7TMkRXjPlcDgC65mnjW4+dyBIU3YTrdOWNqe/M/znjv7 vnynizEUP/PlL6Zcs6Gw6VOZ23MjncDxQpPeQvvli8QpyMqF9iiTQeRqiRC+6wfUWGba yqjl6wCUYZamkBnoMKNkwUeIO7lH8AgRP1lPOXAiskc15S8wMucl1gTYbWpQdrqU/HRq MdSA== 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 :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:dkim-signature; bh=B2nzWA43SctfqP1ezHeTfan06KfDKnUBR++2X2af3Gw=; b=nkzifNgG6S6Ax8O010LWrSaSYUia2I1amPMlT93zbfa43fU7ccxo1/YdHtKZGB4Bms bC2JUNhjp92Z0zgz/XHkhcfiTpVBm3LQVBnzAoOpS0HJ+f24Cn/A71T/poVlEKMhr6Il CH+o+IhvmUAVby7VdW3urMc7Q5UYDkxRgRYWzeTC5BLRjmlAPchlDsoTWKW2MCJTEFst Jp+bds9HiWSfGrGWX2o5DvcHWDb48061a+1B7lkZUAP1pOfSxo7qTqWtBs3bRG0zLQ9v fiZwVBHRuaWcIpDv0XbtbrcVXrd2FOzPiqn0owBW8oquWt1/TsXMwgtdsbqBUvR9kh57 gcQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=k+YOkWKV; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x14si19764367ilm.100.2021.07.19.07.52.52; Mon, 19 Jul 2021 07:53:04 -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=@gmail.com header.s=20161025 header.b=k+YOkWKV; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241251AbhGSOLh (ORCPT + 99 others); Mon, 19 Jul 2021 10:11:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241220AbhGSOJ0 (ORCPT ); Mon, 19 Jul 2021 10:09:26 -0400 Received: from mail-pf1-x42c.google.com (mail-pf1-x42c.google.com [IPv6:2607:f8b0:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65356C061574 for ; Mon, 19 Jul 2021 07:18:04 -0700 (PDT) Received: by mail-pf1-x42c.google.com with SMTP id d12so16711975pfj.2 for ; Mon, 19 Jul 2021 07:49:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=B2nzWA43SctfqP1ezHeTfan06KfDKnUBR++2X2af3Gw=; b=k+YOkWKVK04qEvZ7AKLWBw5Ds+C57Bfyows/xXAnoc/eKY1AMXvJAveZT0N1gryE/g f8ZEphAOk5uXp/ZRhDyOSXrPv/1jP47b880We+EupRmaIa3Z36JgL8MCSaZ2Hxo8mKCP TNVuaiV9kXyVlni6kC/Nvt3SWQ09lax2g1yuJWQvNqLs5agKkLwEUGNX066oDtBBirg9 HTtnykKZEFTSFSndrRRYsPlz7yOLzunVkVdLjVaiau7BjhduGnQE4vexisIQYXJ+EhCy EVa25z+rhOaJ9SG8G+aFxFlML0ZYpjHB4+W9viKxy9mM3WXLzbJkjs8aCFDjbbZ3yXIT AiPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=B2nzWA43SctfqP1ezHeTfan06KfDKnUBR++2X2af3Gw=; b=uGrnNQEu4tyW/gOjSxrCUvLMW2A51FWPjyJj10TR04Pek8uwmgsOC7UvI8kwr6eIe5 q0nP+YSjtRytIEN49o8rk7tskZbVESHsrmXDKrUt6saiEXUlqme2aJjZrq5pIO5lW4Cu Xr8NxmR7TyERnfmz/nW3WK4+FDRKvZYgViHtUt550WsDwmAUHiitMUi9uMX0TVlRmOP7 C9rqfMsds2lTRqhXhp/Q+D43qFiTKcHX1zqctC0SwipGALsN/A/m3jQr07Kc9TU6PvWz ji1r03tYW43ngP1ZPwLK+Rg/eF5VTONVsEDrsmLRTXQxK+efOlAWb2QqCt4jkY9yoFLK brMg== X-Gm-Message-State: AOAM532UZwA22HOe0MR/ej70+6kWSt4BcfywTZG+a3sf5dBC4fEJ8beW ZPoQ7FFdqzCQ+7b+vNu6F24ETwAhMHo= X-Received: by 2002:a63:1266:: with SMTP id 38mr26190909pgs.154.1626706197950; Mon, 19 Jul 2021 07:49:57 -0700 (PDT) Received: from [192.168.1.153] (M106072041033.v4.enabler.ne.jp. [106.72.41.33]) by smtp.gmail.com with ESMTPSA id gb10sm20161764pjb.43.2021.07.19.07.49.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 19 Jul 2021 07:49:57 -0700 (PDT) Subject: Re: [PATCH v4 1/1] riscv: __asm_copy_to-from_user: Optimize unaligned memory access and pipeline stall To: Guenter Roeck , Palmer Dabbelt , Geert Uytterhoeven , Qiu Wenbo , Paul Walmsley , Albert Ou , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org References: <5e1b5d90-5a1e-5e9f-7b92-6c53b8589c2a@gmail.com> <9a2bf544-2aaa-d175-bc0a-c8bcefd8141a@roeck-us.net> From: Akira Tsukamoto Message-ID: <718c5a83-de9f-3b5a-ef36-e52ad5bb4d67@gmail.com> Date: Mon, 19 Jul 2021 23:49:53 +0900 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <9a2bf544-2aaa-d175-bc0a-c8bcefd8141a@roeck-us.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/19/2021 11:24 PM, Guenter Roeck wrote: > On 7/19/21 7:00 AM, Akira Tsukamoto wrote: >> >> On 7/19/2021 10:51 PM, Guenter Roeck wrote: >>> Hi, >>> >>> On 7/19/21 5:53 AM, 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. >>>> >>> >>> I had to revert the original patch from the mainline kernel prior to applying >>> this patch. Obviously that means that there may be other changes affecting the >>> outcome. >>> >>> riscv64 images work, but riscv32 images still fail with this patch applied. >>> The error is a bit different than before, though. >>> >>> ... >>> [   11.899979] Run /sbin/init as init process >>> [   12.152666] random: fast init done >>> moun: applet not found >>> "�����V�t: applet not found >>> /bi�����V�F-: applet not found >>> moun: applet not found >>> swaon: applet not found >>> hostname-F: applet not found >>> >>> After this, the image hangs. >>> >>> For comparison, the mainline kernel (v5.14-rc2) fails as follows. >>> >>> [   10.788105] Run /sbin/init as init process >>> Starting syslogd: OK >>> Starting klogd: OK >>> /etc/init.d/S02sysctl: line 68: syntax error: EOF in backquote substitution >>> /etc/init.d/S20urandom: line 1: syntax error: unterminated quoted string >>> Starting network: /bin/sh: syntax error: unterminated quoted string >>> sed: unmatched '/' >>> /bin/sh: syntax error: unterminated quoted string >>> FAIL >>> /etc/init.d/S55runtest: line 48: syntax error: EOF in backquote substitution >>> >>> I'll be happy to provide information on how to reproduce the problem >>> if needed. Please let me know. >> >> Yes, I do would like to know the procedure of build instruction of your rv32 image. >> Then I would reproduce the error and look into how to fix it. >> > Please have a look at http://server.roeck-us.net/qemu/riscv32/ > and let me know if you need anything else. Thanks for the link. I will work on it tomorrow in my time. Building the kernel with defconfig looks much quicker than the config. I will try it from defconfig and then config. Also I would like to use the same rv32 toolchain. Are you using prebuilt riscv32-linux-gcc? Should not make differences but just in case. Is there a public reference for the way of building your qemu and opensbi? Not sure which version of qemu with which rv32 to build them, rv32i, rv32imad or else. I really appreciate your help. Akira