Received: by 10.223.176.46 with SMTP id f43csp599860wra; Wed, 24 Jan 2018 03:09:54 -0800 (PST) X-Google-Smtp-Source: AH8x227Jy1a0OmmGIL4ogJ2F3nAC3ZG+jYJS3QEnn3hE7cCUMUF/+WViGK2HWy3O2xtqT5Q0cXFQ X-Received: by 10.99.104.131 with SMTP id d125mr7248995pgc.125.1516792194240; Wed, 24 Jan 2018 03:09:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516792194; cv=none; d=google.com; s=arc-20160816; b=p2da3BPZcGiWpys7OIUvPsxSiQfuK7JC5xFHmRiDlxy5XslR6o0A+wVZwJrhD9epjF 0KzY/xf0aJUm8w2JjGTkekyudn2qBn6U/+uuBfs+6QCdB47r1ZvuFNlaWe4UBHvEu5M8 dPowsr6d0McSO/GAdKszKYAJAc8JkZRW5G1DrlR6WU/5ePzJibtxNSi61tUdxIsmBW3R 2D1z9TaBqHBJJHxtv8HCw8/HcURxu/7OzfJV5iXkOtG7fpHf1Vc4k6Tzdxe0vOM9wkZk J7Vgn8L+n7SWdzoylXrIidtXFzm78ASmgxf5D0xlskqkSPYU+2UfQt3Z9TIKdaJstZ2Q N4wA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=gnlRW04D2IMXDZ7kfiXBWZwjwk//ayCwspvugHM7K3Y=; b=hMZA7StM29Dpfq7gyAo4Hcrnkurx1aVutsEN5ad0XgxwlsAkJLfXctu7D2mkGL5OGz 9cNWT1yMS9C9qJgz3L0Wqw8v+gSr7BkLh0UcVOc1V9QzfQJ72C/BYoE4/J6ifIBGx6We 6t+CK0XtZkBPjip4bc7/4/KRgO4JgKDhF7g+wS73Of0+K8S5D9jtd9KyAm7D3Yi0BYWF PuRIGiXkifZ3VtMTpoNCOkM5bc0p6sXdydG7YWwxMhaUCbpZJykvBABj/2VkdHhbcIs2 P121nLzrQE8JavDbJToXmVBk2m/XmKUkW+joaXj+fGZtHutG+yTTrwi0xklPzy9fh0Vj cOPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Cp354ljz; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v137si2818pgb.753.2018.01.24.03.09.39; Wed, 24 Jan 2018 03:09:54 -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=fail header.i=@gmail.com header.s=20161025 header.b=Cp354ljz; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933172AbeAXLJI (ORCPT + 99 others); Wed, 24 Jan 2018 06:09:08 -0500 Received: from mail-ot0-f195.google.com ([74.125.82.195]:41068 "EHLO mail-ot0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933062AbeAXLJE (ORCPT ); Wed, 24 Jan 2018 06:09:04 -0500 Received: by mail-ot0-f195.google.com with SMTP id 44so3227373otk.8; Wed, 24 Jan 2018 03:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=gnlRW04D2IMXDZ7kfiXBWZwjwk//ayCwspvugHM7K3Y=; b=Cp354ljzHRLTq8o+guyz5GnFUiaLwURmWrW+w2vqZ5P1NgF5NZBGOHboOlnAqlclfz TURKxtoiqPE5oITf9wr6Adl4CfoMOt7uppoyPNZELpOqRKMhvHrg3hNz+z6TCKj1yGhy odwtRnXqzAAPXuKzJetQ4eCeL060eLpqaXmFNMp7CAfp7ZPy1uXKHeJfRwKJAMH94VJG Bl+P1mREjp8EQWpnWqyy4ytUyUrkaFgjrKt77ntVcvlUgzIz8O5MJAl8KLiC2Q9m3nMh c3zd/Y5IQttFk++hCHCvnLvjphE46LDIPLbNlIDZbt4MhtxNYz0jWrXHbv5jbJgi2qhq 8JoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=gnlRW04D2IMXDZ7kfiXBWZwjwk//ayCwspvugHM7K3Y=; b=C3AXj6qL1DL3lE6fDabekkL7oeodYprtZYTVPb6V1epmfOJ7np0Szjp0Q2I9UHrvZd 1fLokgGrvXvwkv392gqMvfhCvhWrNT0n062l+XGxbzdaPVEK7EhpIxMHY1dahb0/A+wx NxIyVE4kQ3zJljcfdnDX5Muci6/+Ev2H4Pf9zRr5/C4fmJutGQzfN3zyrnu9tw5Fg6uK TE4M8AJq5wVJqHyy/VOx5ddVaezf2rRXM9iKJ9u0FuWKlRDk3efvtI8H9MOMtX5kW9Sz ooPqn7iy24KpeX195VoEnziY22T9+dWzLAx/C97poJKYn87+C0atWC3Hoqs0OJZRDm6w JIfw== X-Gm-Message-State: AKwxytf+/5CplBe9PiP0iNPAb/p6FcPkScVD+BxJFAs6ori4/Wva+WQF dJjxrWJ5Y9zool2HZu33egka/yVVxjmG5WeT4Fw= X-Received: by 10.157.39.229 with SMTP id c92mr8688119otb.212.1516792143626; Wed, 24 Jan 2018 03:09:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.68.119 with HTTP; Wed, 24 Jan 2018 03:09:02 -0800 (PST) In-Reply-To: References: <28c2c9da4da4c8b07473e97cd4a6cb953f4b507c.1515766253.git.green.hu@gmail.com> From: Arnd Bergmann Date: Wed, 24 Jan 2018 12:09:02 +0100 X-Google-Sender-Auth: dV0kEXWgjXcxa0EI-EqvYyAOidw Message-ID: Subject: Re: [PATCH v6 07/36] nds32: Exception handling To: Vincent Chen Cc: Greentime Hu , 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" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 24, 2018 at 11:53 AM, Vincent Chen wrote: > 2018-01-18 18:14 GMT+08:00 Arnd Bergmann : >> On Mon, Jan 15, 2018 at 6:53 AM, Greentime Hu wrote= : >>> From: Greentime Hu >>> >>> This patch includes the exception/interrupt entries, pt_reg structure a= nd >>> related accessors. >>> >>> Signed-off-by: Vincent Chen >>> Signed-off-by: Greentime Hu >> >> Here it would be good to have a more detailed explanation about the alig= nment >> trap handling. I remember discussing it with you before, but don't remem= ber >> the exact outcome. In particular you should explain here why you need to >> handle alignment traps in the first place, and what the expected default= s >> are (e.g. always disabled unless a user requests it, or always enabled) = and >> what kind of code runs into the traps (e.g. buggy kernel code, correct >> kernel code, buggy user space code etc). >> >> Arnd > > > Dear Arnd: > > I am plans to add the following description in the git commit's comment > > Andes processors cannot load/store information which is not naturally ali= gned > on the bus, i.e., loading a 4 byte data whose start address must be divis= ible > by 4. If unaligned data accessing is happened, data unaligned exception w= ill be > triggered and user will get SIGSEGV or kernel oops according to the unali= gned > address. In order to make user able to load/store data from an unaligned > address, software load /store emulation is implemented in > arch/nds32/mm/alignment.c to handle data unaligned exception. > > Unaligned accessing handling is disable by default because of it is not > a normal case. User can follow the steps below to enable this feature. > > A. Compile time: > 1. Enable kernel config CONFIG_ALIGNMENT_TRAP > B. Run time: > 1. Enter /proc/sys/nds32/unaligned_acess folder > 2. > a. Write =E2=80=981=E2=80=99 to file enable_mode to enable unalig= ned accessing handling > for user space > b. Write =E2=80=982=E2=80=99 to file enable_mode to enable unalig= ned accessing handling > for kernel space > c. Write =E2=80=983=E2=80=99 to file enable_mode to enable unalig= ned accessing handling > for user and kernel space > d. Write '0' to file enable_mode to disable all unaligned > accessing handling > 3. > a. Write =E2=80=981=E2=80=99 to file debug to show which unaligne= d address is addressed > b. Write =E2=80=980=E2=80=99 to file debug to disable all informa= tion > > However, unaligned accessing handler can=E2=80=99t work on following cond= itions. > A. The corresponding mode for unaligned address is not enabled. > B. This unaligned address is not accessible such as protection violation. > On these conditions, the default behaviors for data unaligned > exception still happen. 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. Arnd