Received: by 10.223.176.5 with SMTP id f5csp4401960wra; Tue, 30 Jan 2018 06:51:03 -0800 (PST) X-Google-Smtp-Source: AH8x226Dyy+q0DyvdEIu1opRdgWaQperu7JXeM+I+AX/yA5Vj/XPWztLlNlCwnhStn4lkZwtzwuK X-Received: by 10.99.126.26 with SMTP id z26mr23870592pgc.151.1517323863018; Tue, 30 Jan 2018 06:51:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517323862; cv=none; d=google.com; s=arc-20160816; b=W5jf4XN0DLYNvaDlgEf+9DXb0Ub0K/EMzWqZELSMQOM/0E3hTE27guajSoUrCz3Q2Y KNJ+dju0XiwNo+grW0UEJBrJED3qpyCuBYfr+vYszpWutFJuTjNnZl5l9W+dxJ2f5vSr 7ixHjrWWXGxnpDq85ojQCL7ZcqvKvPK7961L/ZFid7E8Gpfj5kTFQyCHOB0Kza1tttni ZalQ5h7jMmqVP1VKzp67CG0dF8oSA2SlDBs8BnSdlH5c0mEdFWTtw1beqHERq8mv91By kqjMo9IxRzj1jUZ4tGsBLCS8r+XBKbMg2TR+KVW5NgTiDTe+anbMG4K0Pa9b7TPX/JK9 QJDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=BhEs8jp/N7ih+rqzvosn7g4Tvm1+pPlFH+A31LaJJo0=; b=Ikc7LM+XI/GhWFisLtUIQmj4fpWMk+bY2nd9mJXklvHyIEuZO/n3Qn44Wp9msSJoB8 CAAUtH8w3T/NHUy9FPnZL/+vSIUJefp1WWICSrCorfGXqzCzIo17r41fqs3WVABBbI4a RQG3dhWunwpW21TREeuS9owkoa/3F33B//8+skq0okk7fMLbcUDFK/cPU9+p4cVwr6WV LWj8SlfmeSbDmE/LBP99LJBVmDx940Im5si2jvmFVUmqYSABwUMfSGAmi92I3nsMKUhJ Ev2pQDu3QE19jXiJFrdOr6QYtyPI+898K2ooVH5IuXbYd0xvXbcKC7IPIKlWqHq6dS0i e3dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=viFtA2Zj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k68si8964pfh.89.2018.01.30.06.50.47; Tue, 30 Jan 2018 06:51:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=viFtA2Zj; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751588AbeA3OuR (ORCPT + 99 others); Tue, 30 Jan 2018 09:50:17 -0500 Received: from mail-vk0-f65.google.com ([209.85.213.65]:42046 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751197AbeA3OuO (ORCPT ); Tue, 30 Jan 2018 09:50:14 -0500 Received: by mail-vk0-f65.google.com with SMTP id t4so6900313vkb.9; Tue, 30 Jan 2018 06:50:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BhEs8jp/N7ih+rqzvosn7g4Tvm1+pPlFH+A31LaJJo0=; b=viFtA2ZjAz/Dxt1XLdSibwox0naC8nY3iRs6P+XrGXanjL/QRLGmrZVk2bbv9O3ef9 ZTWzp2ZVNxK2AWHfnxTSxZLNZ5grLM2gtELwZouNb3Et4Bbhkb8ESD6LsGqCAaE026Wz h1C7YF1GDwYBZyb/17GtB1BGxTPJvu55NuZnjv7dAhgCQczK0gxNlctAwubWP5P/C8GT Ssi7jOElqwrRiW0WFiR7I7PgZePQ0b00kRDvnrcwnNXwHs6haaK87sJqj4YkGE/hicxl dkgWlBrAR4PT6lT6OOC8OTdxZVjOLrAKnyLio0rZR892Gku06J9A1MyoSdxrWuq1SF4R 7K2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BhEs8jp/N7ih+rqzvosn7g4Tvm1+pPlFH+A31LaJJo0=; b=k/ESaSTkhOKhHVYRv6XKFZcHDZZHXMpO63EcoCAvVKVrLE+fo/Lrb1Tx+99YxfvJmH lxAW623zP70CDyDC/7Xu7SvhM4lrx8A6mmmo17QFVwBnV24xRrXdcnrp47BkpHg77vEU NSnSXy1c/P9dDdAK0BUpnmzet5LIQNAZEbuWCEIOy2Q34DkWE6vlw4OS3qqdbfxNx73b 8B8Ga2IswhL79k4DnFV2oXin4xG2YQJ2LJVWn4/mLtR1EvOL+9oBlpqGlFOGbLHG8BZK fHO5TcjDg9mtaLKCzkEma/OCyflSxbEeuqJco8NCWPsqNiP7Dumymct12p0+xb9CvIs+ 2ZsQ== X-Gm-Message-State: AKwxyteDWnQkHz4MwD0KFMpz7Rajq2oiv5jqahdtzev7tis3a7nzUvm0 HXgT2qDJjG6Ya1XLVhGPen555pzOdTY0ts4x3v4= X-Received: by 10.31.108.66 with SMTP id h63mr22583928vkc.198.1517323812594; Tue, 30 Jan 2018 06:50:12 -0800 (PST) MIME-Version: 1.0 Received: by 10.159.42.194 with HTTP; Tue, 30 Jan 2018 06:49:32 -0800 (PST) In-Reply-To: References: <28c2c9da4da4c8b07473e97cd4a6cb953f4b507c.1515766253.git.green.hu@gmail.com> From: Greentime Hu Date: Tue, 30 Jan 2018 22:49:32 +0800 Message-ID: Subject: Re: [PATCH v6 07/36] nds32: Exception handling To: Arnd Bergmann Cc: Vincent Chen , Greentime , Linux Kernel Mailing List , linux-arch , Thomas Gleixner , Jason Cooper , Marc Zyngier , Rob Herring , Networking , DTML , Al Viro , David Howells , Will Deacon , Daniel Lezcano , linux-serial@vger.kernel.org, Geert Uytterhoeven , Linus Walleij , Mark Rutland , Greg KH , Guo Ren , Randy Dunlap , David Miller , Jonas Bonn , Stefan Kristiansson , Stafford Horne , Vincent Chen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Arnd: 2018-01-30 21:33 GMT+08:00 Arnd Bergmann : > On Tue, Jan 30, 2018 at 11:01 AM, Vincent Chen wrote: >> 2018-01-24 19:10 GMT+08:00 Arnd Bergmann : >>> On Wed, Jan 24, 2018 at 12:09 PM, Arnd Bergmann wrote: >>>> On Wed, Jan 24, 2018 at 11:53 AM, Vincent Chen wrote: >>>>> 2018-01-18 18:14 GMT+08:00 Arnd Bergmann : >>> >>>> Ok. I still wonder about the kernel part of this though: is it a good idea >>>> for user space to configure whether the kernel does unaligned >>>> accesses? I would think that the kernel should just be fixed in such >>>> a case. >>> >>> To clarify: I'm asking only about unaligned accesses from kernel code itself, >>> which is generally considered a bug when >>> CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is disabled. >>> >>> Arnd >> >> Thanks for your comments. >> >> For performance, we decide always disable >> CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS even if hardware supports >> unaligned accessing. Therefore, I will remove kernel unaligned accessing from >> nds32/mm/alignment.c. In other words, alignment.c only addresses unaligned >> accessing for user space. > > I'm not really following that logic, let's go through that again so I understand > the situation better. > > CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS should be set if and > only if you have a CPU that does not need to trap on unaligned accesses. > > What are the hardware capabilities on nds32? Do you have all three > categories: > > a) some CPUs that always trap on unaligned access > b) some CPUs that never trap on unaligned access > c) some CPUs that can be configured to either trap or not trap by > the kernel? > We have type a and c. We use CONFIG_ALIGNMENT_TRAP for a and CONFIG_HW_SUPPORT_UNALIGNMENT_ACCESS for c. Since unaligned access in kernel code itself should be considered as a bug, we will remove the emulation code to handle the kernel code unaligned accessed case. We think CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS and CONFIG_HW_SUPPORT_UNALIGNMENT_ACCESS have different purposes because it will still be more efficient to access by byte even if hardware support unaligned access. CONFIG_HW_SUPPORT_UNALIGNMENT_ACCESS is used to prevent generating unaligned access exception. Thus, we will 1. treat unaligned access in kernel code itself as a bug 2. don't select CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 3. disable CONFIG_HW_SUPPORT_UNALIGNMENT_ACCESS as default