Received: by 10.223.176.46 with SMTP id f43csp584613wra; Wed, 24 Jan 2018 02:55:07 -0800 (PST) X-Google-Smtp-Source: AH8x226UxadIEjKfe0PeWGc+Xq0x2yCK6mdPpOf8pw9yDg6rlZiR+XsVDp6M3dvhT9VS02wmPXng X-Received: by 10.99.112.25 with SMTP id l25mr10501171pgc.154.1516791307322; Wed, 24 Jan 2018 02:55:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516791307; cv=none; d=google.com; s=arc-20160816; b=Z8fSilMzD1zZ6NLi1ATU0IgqMq9lMeNemF3jBWDuqdP91+VU2o3M1r0CDm8TSDw3Pg eSqv/3jeKwB8zKw9PMoszaeQHJ9nA+7aRKsd+YkhWPGkkBNYYQXaC29sM3e5YOUYV1V7 EMoybZMCzQAYDeh2YtUofftIp3WVjQKcxLLFzk4mDnKQLpmLkhbva9jGNprHvaD66UcS 9trNchSYqV4ZKHl5XlwQ25b0eNhnMEouYyykHKF1pI3TYU/L5KpwE+lV2ecbIVGTj53p 0GrGCukHaeVK+cSeNOii9PDwWOd1L/jNDGepDQGyGLw0tRi+HA9zC7tac7kg8HQDEuxC NWEQ== 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=zHYtDpniClYZQjAVNaoWPbYdLXga3mlAhU3q0i+dYcg=; b=sL6PcCby8sw26rzw+F992PURwLtPzlkvWVyaz721LyBlZH70odsovg98RYRQJGPG08 HSrSeHPcRZIGMu2eKKE8yNGBfc5wdyg2+p3334DAKvWgilg8JbXccHUOO1NLOnMYTssH eq2BefMOTOtRXGQkpvyApEH6dWk1iFoALOfPxqc/2boGLw2Ycf4LiYcHbeM1vFKlpSib 9B5txFY/BGKTIc7KHOBAbiuGgg6ix8+i7o1Nt8utJ/zpdPvp+n6Xbs5JIg0xlIwBNgaX Xu2a+BqKrk5MdeAIdNvWr7jJT8ZZrbE+P0yv7qhEHgy0oYsc/gKaOfr2qhXHo8W+fhkL fzbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jEIwWpt5; 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 j61-v6si35049plb.108.2018.01.24.02.54.52; Wed, 24 Jan 2018 02:55:07 -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=jEIwWpt5; 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 S933160AbeAXKyH (ORCPT + 99 others); Wed, 24 Jan 2018 05:54:07 -0500 Received: from mail-it0-f65.google.com ([209.85.214.65]:43326 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932953AbeAXKyB (ORCPT ); Wed, 24 Jan 2018 05:54:01 -0500 Received: by mail-it0-f65.google.com with SMTP id u62so4741675ita.2; Wed, 24 Jan 2018 02:54:00 -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:content-transfer-encoding; bh=zHYtDpniClYZQjAVNaoWPbYdLXga3mlAhU3q0i+dYcg=; b=jEIwWpt5own0pZZhMtNdr8aiQ8LVDhOBLvMNdrOWXQ3uzc1kz+GObWmGXzwWggp4D6 3PKo8QcfBum4Du5RP4maK9byxhMHYKixoADtDs/3jEfHs5SpTjNyNTyL1zCetc+7CcEg lUIMK1g483spmQGWHaUeUW+VeGrBHSnhkYnwg/LRdBG33lI+Q+L0yE4P+AIUyXA7OB1Q iETUraXr3oCMGt28rafv50E2RDWyiIc3OuPOJDRV+1aR87h42PQGQat1MlVb3KpzTn07 CmuwtZAwyTFdYTAZBc+oc31TJjvFBKIPCoF9UxEiOoD3pOTSp7F+JK6d3RA0ESzyx1Rg fOBA== 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:content-transfer-encoding; bh=zHYtDpniClYZQjAVNaoWPbYdLXga3mlAhU3q0i+dYcg=; b=VGbRdSwtvYbqq8MW+TpvsoCz2ktnreHyCetVJOUOPT5Tfnr4MUM/7r4W+CRqFd3QAw sABdugJn0yCyhB2/qBetA/JGuDbWhDTtz0VC994/RYrM4WiLgY3M1K+WQuYTcziNKrLJ nmBiLAgQFNDLj2H5KK+Didr7xrROI3S7vaqIjSxZuV/3TC3lFYgJqwSa8Zcq/mRxebu8 s/9YITOmVHLH3N0yv+iM+lxo/g+eZMrErxN7KJQjlWLzH7swBR2JY4x0ljtLfLnls9/T QtTm8ZLPvKr0MLJvEILIiNrJaIPcSRUa1dw3K5rQi40do1DJ2OuxSPp8bBduBBs8Hqmb yspQ== X-Gm-Message-State: AKwxytcP9efax9nvCXkbAfYCZdvbPk1CXqbNvN8bP4p59pfQIx8alhJY lEw/c0SXMYxGAM+XJeVIkjJb347AJgb2oYXay+U= X-Received: by 10.36.61.205 with SMTP id n196mr8394731itn.95.1516791240318; Wed, 24 Jan 2018 02:54:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.175.34 with HTTP; Wed, 24 Jan 2018 02:53:59 -0800 (PST) In-Reply-To: References: <28c2c9da4da4c8b07473e97cd4a6cb953f4b507c.1515766253.git.green.hu@gmail.com> From: Vincent Chen Date: Wed, 24 Jan 2018 18:53:59 +0800 Message-ID: Subject: Re: [PATCH v6 07/36] nds32: Exception handling To: Arnd Bergmann 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 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 an= d >> 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 align= ment > trap handling. I remember discussing it with you before, but don't rememb= er > the exact outcome. In particular you should explain here why you need to > handle alignment traps in the first place, and what the expected defaults > are (e.g. always disabled unless a user requests it, or always enabled) a= nd > 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 align= ed on the bus, i.e., loading a 4 byte data whose start address must be divisib= le by 4. If unaligned data accessing is happened, data unaligned exception wil= l be triggered and user will get SIGSEGV or kernel oops according to the unalign= ed 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 unaligne= d accessing handling for user space b. Write =E2=80=982=E2=80=99 to file enable_mode to enable unaligne= d accessing handling for kernel space c. Write =E2=80=983=E2=80=99 to file enable_mode to enable unaligne= d 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 unaligned = address is addressed b. Write =E2=80=980=E2=80=99 to file debug to disable all informati= on However, unaligned accessing handler can=E2=80=99t work on following condit= ions. 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. Thanks Vincent