Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3089271pxb; Mon, 24 Jan 2022 02:05:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJyaGl9ci+rZGPf7TZJeZZh+pt2wGxJecIJDubGVb63ItTBCuXZr1YpWkqdn9BhyuiUc9CXV X-Received: by 2002:aa7:88c4:0:b0:4c1:c2d3:f187 with SMTP id k4-20020aa788c4000000b004c1c2d3f187mr13315287pff.66.1643018752620; Mon, 24 Jan 2022 02:05:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643018752; cv=none; d=google.com; s=arc-20160816; b=S7oG20srfLo3KwgRo96NoYkuhMLMvAkrSiv+sBmt1GLr0Ey3BIC4KMVU4MAYo/Q1w3 cfw8zTkRBXRJb0ChWf4rcBUYstA/VdOt+i19AeQJwRjhBPHJkmoBLFTPr5KQaHgUj+nj RZ36BqY3DlPzKkCPAIpvUmvNsnwtz2asvcOTtnE2zWrOd4gY0NlzJxtbZKWRtT8JrBv5 DYdjc8Fc6KonCCAi5v1DEM4Hx8pYBfKsK7yGtDVzxrrTqWpGebU8PfI3Xn6rF7NN26ao JqwVC5IYzz8q0E1/ldLwEpmE6kHWCj4C5nNL6Mnksg4Rq/vXt3Vf/VQT8jaJxuArDs6H opGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=nfUCrgltiuESmGAEDtw9bdfISibes8TAv+qKIXGxuic=; b=hPIGl8ckGiCmabZs8+k/VkLwz9uOCdtQcgoobk/zW8TNfaTEHb021Sspp7w+vGQ/qy DBOi9uK7AVTtWrHdKqfWwb0hjCa6h2varJdJUL2pEc2uVdt3R0ybczAflPrfX7ywRcR8 vm60oxlnp0s/CW0e+u6wxaLYjYQN5zL/9dT++BlNaq1pO2ZD2BxpCGDmbz+usPR7xkEh vtlVf72VO5cRSODk65HxnFYFDEsvr6ShM6lFnUfp5wh48ajYqC8/ACly2fV3ViEUSLpo 0R1fZyZZKiBRneXPoF8egGcJJmoF2x1qZEI/wAfTFC3tgpDv0bKGnB4JwnvnetKTKTLc PS5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@jrtc27.com header.s=gmail.jrtc27.user header.b=Zz1rjr+O; 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 w184si82027pgd.9.2022.01.24.02.05.40; Mon, 24 Jan 2022 02:05:52 -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; dkim=pass header.i=@jrtc27.com header.s=gmail.jrtc27.user header.b=Zz1rjr+O; 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 S238024AbiAWPoz (ORCPT + 99 others); Sun, 23 Jan 2022 10:44:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238020AbiAWPoy (ORCPT ); Sun, 23 Jan 2022 10:44:54 -0500 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA7F1C06173B for ; Sun, 23 Jan 2022 07:44:53 -0800 (PST) Received: by mail-wr1-x42c.google.com with SMTP id a13so9116989wrh.9 for ; Sun, 23 Jan 2022 07:44:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=jrtc27.com; s=gmail.jrtc27.user; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=nfUCrgltiuESmGAEDtw9bdfISibes8TAv+qKIXGxuic=; b=Zz1rjr+Oaa1cFDW4Ogh1s0Dc6tRdjPe3+yJjgn9CXxfzgEto8FZ+qBc5OOqQt+wg2g 86VMddvrTwe3r5BvseJWhSMizn31JbvnKgcrDhig3JnZk2XCLXgzqSWUC8NhyhnFEHQK 0FP1z/IIQY1a0DG8xZ6zAWheMH4h2tsovocf5EFaEYtIY04+mKB3Y6qB986mMyv3y8Zv 9ftdyp/cOWHazPHa9Zw6WnzHDb9q/rJgkv7k6VhCc30hD+4ZhueqoZcV5oLRNWJoJbyW rM+QaanVdc47C5HuUlHcN5c2Ekg8LZhLqcWlk/wBjm4g33CRo5QHhKE4uZaghxiD5MRn 3zvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=nfUCrgltiuESmGAEDtw9bdfISibes8TAv+qKIXGxuic=; b=TvMvU2sZStq7ZNuBbXRSb64jS415tzuFuNfToW4YslncbSX2Gi/qzqcIfnH02TteaJ SUSz2VgZC9eCOztVzThT8FX4dbdiGx3LnslSY/MBzUGzSkWgx4hrFyT+kG2I6AsIsmGm LK0DZuHu8cgoqdMXeOZ4LoZNN1odfJ8YV/HeEYtjaDiJRqIdq/T+6yeEMb+t7HSW7DhB hjnTvlH0l7VOGZ8Ucxds5syJerA/6ogc3wIVH4+Y+D/JW4jT3sBFDuau/+Ez5T+PIStX tIwOC1XqNpUx5E52lXGGUjjhvaL/PCMTx2V7WGRTXyXFBUwTaBadX7JEAihCWjleEK3C WBZQ== X-Gm-Message-State: AOAM532B4SlVSPfEZzQI+fDfmVC8viaXP1BTDyovcOm+xoou0EWNykxs C3rXTkJrqNHoJ0pgNsK5ubV2MQ== X-Received: by 2002:adf:f192:: with SMTP id h18mr358315wro.314.1642952692393; Sun, 23 Jan 2022 07:44:52 -0800 (PST) Received: from smtpclient.apple (global-5-142.nat-2.net.cam.ac.uk. [131.111.5.142]) by smtp.gmail.com with ESMTPSA id l7sm13366441wrs.104.2022.01.23.07.44.51 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Jan 2022 07:44:52 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 15.0 \(3693.40.0.1.81\)) Subject: Re: [PATCH v2] Fixed: Misaligned memory access. Fixed pointer comparison. From: Jessica Clarke In-Reply-To: <20220123034518.3717116-1-michael@michaelkloos.com> Date: Sun, 23 Jan 2022 15:44:51 +0000 Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , linux-riscv , linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <485047B2-E566-4679-87CF-C4B3CAFEF108@jrtc27.com> References: <20220123034518.3717116-1-michael@michaelkloos.com> To: "Michael T. Kloos" X-Mailer: Apple Mail (2.3693.40.0.1.81) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23 Jan 2022, at 03:45, Michael T. Kloos = wrote: >=20 > Rewrote the riscv memmove() assembly implementation. The > previous implementation did not check memory alignment and it > compared 2 pointers with a signed comparison. The misaligned > memory access would cause the kernel to crash on systems that > did not emulate it in firmware and did not support it in hardware. > Firmware emulation is slow and may not exist. Additionally, > hardware support may not exist and would likely still run slower > than aligned accesses even if it did. The RISC-V spec does not > guarantee that support for misaligned memory accesses will exist. > It should not be depended on. >=20 > This patch now checks for the maximum granularity of co-alignment > between the pointers and copies them with that, using single-byte > copy for any unaligned data at their terminations. It also now uses > unsigned comparison for the pointers. >=20 > Added half-word and, if built for 64-bit, double-word copy. >=20 > Migrated to the newer assembler annotations from the now = deprecated > ones. >=20 > Commit Message Edited on Jan 22 2022: Fixed some typos. >=20 > [v2] >=20 > Per kernel test robot, I have fixed the build under clang. This > was broken due to a difference between gcc and clang, clang requiring > explict zero offsets the jalr instruction. gcc allowed them to be > omitted if zero. Unlike LLVM, GCC does not have an assembler, that=E2=80=99s binutils=E2=80= =99s GNU as. Jess