All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: <linux-mips@linux-mips.org>
Subject: Re: [PATCH 00/58] Add support for Enhanced Virtual Addressing
Date: Tue, 4 Feb 2014 09:00:46 +0000	[thread overview]
Message-ID: <52F0AC3E.5050806@imgtec.com> (raw)
In-Reply-To: <52E94A85.3040602@gmail.com>

Hi David,

I have some comments

On 01/29/2014 06:37 PM, David Daney wrote:
> This whole thing seems very messy.  I see a couple of problems:
>
> 1) There are if(CONFIG_EVA) ... else ... endif  all over the place.  It
> is very ugly.
>
> 2) You cannot have a signel kernel with both EVA and non-EVA support.


Unfortunately, I don't think using eva=1 or whatever in the kernel 
command line would work. First of all, there is board specific init code 
long before the command line is available. See patch #51. At that point, 
the kernel command line is not 'exposed' yet so there is no way to tell 
if you are booting in EVA or non-EVA mode.

>
> Have you considered just tagging all the instructions that touch the
> user address space, and patching them at system boot with their EVA
> equivalents if EVA support is desired?

I don't think this is possible (or maybe i don't understand your 
proposal). Consider for example the copy_user function in memcpy.S. This 
function does copy_{to,from,in} user/kernel depending on the supplied 
virtual address. There is no way to tell in advance if a 'lb' 
instruction will load from kernel or user space. This is only possible 
during runtime by examining the get_fs() == get_ds() status. Therefore, 
it's necessary to have 4 variants of this functions replacing only the 
'store' or 'load' instructions that you really need to. For example

- load from user, store to kernel
- load from kernel, store to user
- load from user, store to user
- load from kernel, store to kernel

As you can see, static replacement of the instructions with the EVA ones 
during boot will not work as expected.

This is the reason I converted these functions to macros, so all the 
variants will be a simple 3 line assembler code that only replaces the 
instructions you are really interested in.

-- 
markos

WARNING: multiple messages have this Message-ID (diff)
From: Markos Chandras <Markos.Chandras@imgtec.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH 00/58] Add support for Enhanced Virtual Addressing
Date: Tue, 4 Feb 2014 09:00:46 +0000	[thread overview]
Message-ID: <52F0AC3E.5050806@imgtec.com> (raw)
Message-ID: <20140204090046.9Lv4TwpOXXd1RXGZn7lfkTAua7Aqakx1LmKOs8LUS0Q@z> (raw)
In-Reply-To: <52E94A85.3040602@gmail.com>

Hi David,

I have some comments

On 01/29/2014 06:37 PM, David Daney wrote:
> This whole thing seems very messy.  I see a couple of problems:
>
> 1) There are if(CONFIG_EVA) ... else ... endif  all over the place.  It
> is very ugly.
>
> 2) You cannot have a signel kernel with both EVA and non-EVA support.


Unfortunately, I don't think using eva=1 or whatever in the kernel 
command line would work. First of all, there is board specific init code 
long before the command line is available. See patch #51. At that point, 
the kernel command line is not 'exposed' yet so there is no way to tell 
if you are booting in EVA or non-EVA mode.

>
> Have you considered just tagging all the instructions that touch the
> user address space, and patching them at system boot with their EVA
> equivalents if EVA support is desired?

I don't think this is possible (or maybe i don't understand your 
proposal). Consider for example the copy_user function in memcpy.S. This 
function does copy_{to,from,in} user/kernel depending on the supplied 
virtual address. There is no way to tell in advance if a 'lb' 
instruction will load from kernel or user space. This is only possible 
during runtime by examining the get_fs() == get_ds() status. Therefore, 
it's necessary to have 4 variants of this functions replacing only the 
'store' or 'load' instructions that you really need to. For example

- load from user, store to kernel
- load from kernel, store to user
- load from user, store to user
- load from kernel, store to kernel

As you can see, static replacement of the instructions with the EVA ones 
during boot will not work as expected.

This is the reason I converted these functions to macros, so all the 
variants will be a simple 3 line assembler code that only replaces the 
instructions you are really interested in.

-- 
markos

  reply	other threads:[~2014-02-04  9:00 UTC|newest]

Thread overview: 126+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 20:18 [PATCH 00/58] Add support for Enhanced Virtual Addressing Markos Chandras
2014-01-27 20:18 ` Markos Chandras
2014-01-27 20:18 ` [PATCH 01/58] MIPS: Kconfig: Add Kconfig symbols for EVA support Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:18 ` [PATCH 02/58] MIPS: asm: Add prefetch instruction for EVA Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:18 ` [PATCH 03/58] MIPS: asm: Add wrappers for EVA/non-EVA instructions Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-03-06 15:52   ` [PATCH v2 " Markos Chandras
2014-03-06 15:52     ` Markos Chandras
2014-01-27 20:18 ` [PATCH 04/58] MIPS: futex: Add EVA support for futex operations Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:18 ` [PATCH 05/58] MIPS: uapi: inst: Add new EVA opcodes Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:18 ` [PATCH 06/58] MIPS: uapi: inst: Add instruction format for SPECIAL3 instructions Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:18 ` [PATCH 07/58] MIPS: kernel: scall32-o32: Use EVA wrappers to fetch syscall arguments Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:18 ` [PATCH 08/58] MIPS: kernel: traps: Whitespace clean up Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:18 ` [PATCH 09/58] MIPS: traps: Set correct address limit for breakpoints and traps Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:18 ` [PATCH 10/58] MIPS: lib: strnlen_user: Use macro to build the strnlen_user symbol Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:18 ` [PATCH 11/58] MIPS: lib: strnlen_user: Add EVA support Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:18 ` [PATCH 12/58] MIPS: lib: strlen_user: Use macro to build the strlen_user symbol Markos Chandras
2014-01-27 20:18   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 13/58] MIPS: lib: strlen_user: Add EVA support Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 14/58] MIPS: lib: strncpy_user: Use macro to build the strncpy_from_user symbol Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 15/58] MIPS: lib: strncpy_user: Add EVA support Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 16/58] MIPS: lib: memcpy: Merge EXC and load/store macros Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 17/58] MIPS: lib: memcpy: Split source and destination prefetch macros Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 18/58] MIPS: lib: memcpy: Use macro to build the copy_user code Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 19/58] MIPS: lib: memcpy: Add EVA support Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 20/58] MIPS: lib: memset: Whitespace fixes Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 21:43   ` Sergei Shtylyov
2014-01-27 20:55     ` Markos Chandras
2014-01-27 20:55       ` Markos Chandras
2014-01-27 20:19 ` [PATCH 21/58] MIPS: lib: memset: Use macro to build the __bzero symbol Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 22/58] MIPS: lib: memset: Add EVA support for the __bzero function Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 23/58] MIPS: asm: uaccess: Add instruction argument to __{put,get}_user_asm Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 24/58] MIPS: asm: uaccess: Move duplicated code to common function Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 25/58] MIPS: asm: uaccess: Disable unaligned access macros for EVA Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 26/58] MIPS: asm: uaccess: Use EVA instructions wrappers Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 27/58] MIPS: asm: uaccess: Rename {get,put}_user_asm macros Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 28/58] MIPS: asm: uaccess: Add EVA support to copy_{in, to,from}_user Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 29/58] MIPS: asm: uaccess: Add EVA support for str*_user operations Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 30/58] MIPS: kernel: unaligned: Add EVA instruction wrappers Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 31/58] MIPS: kernel: unaligned: Handle unaligned accesses for EVA Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 32/58] MIPS: checksum: Split the 'copy_user' symbol Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 33/58] MIPS: lib: csum_partial: Merge EXC and load/store macros Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 34/58] MIPS: lib: csum_partial: Add macro to build csum_partial symbols Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 35/58] MIPS: lib: csum_partial: Add EVA support Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 36/58] MIPS: asm: checksum: Split kernel and user copy operations Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 37/58] MIPS: asm: checksum: Add MIPS specific csum_and_copy_from_user function Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 38/58] MIPS: kernel: signal: Prevent save/restore FPU context in user memory Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 39/58] MIPS: asm: r4kcache: Build flushing code for instruction cache Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 40/58] MIPS: asm: r4kcache: Add protected cache operation for EVA Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 41/58] MIPS: asm: r4kcache: Add EVA cache flushing functions Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 42/58] MIPS: kernel: {ftrace,kgdb}: Set correct address limit for cache flushes Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 43/58] MIPS: asm: page: Allow __pa_symbol overrides Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 44/58] MIPS: asm: cpu: Add cpu flag for Enhanced Virtual Addressing Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 45/58] MIPS: kernel: cpu-probe: Enable EVA option on supported cores Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 46/58] MIPS: kernel: proc: Add EVA to the list of CPU features Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 47/58] MIPS: mm: init: Add free_init_pages() callback for EVA Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 48/58] MIPS: mm: c-r4k: Build EVA {d,i}cache flushing functions Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 49/58] MIPS: mm: c-r4k: Add support for flushing user pages from cache Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 50/58] MIPS: mm: c-r4k: Flush scache to avoid cache aliases Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 51/58] MIPS: malta: Configure Segment Control registers for EVA boot Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 52/58] MIPS: malta: spaces.h: Add spaces.h file for Malta (EVA) Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 53/58] MIPS: malta: malta-memory: Add support for the 'ememsize' variable Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 54/58] MIPS: malta: malta-memory: Use the PHYS_OFFSET to build the memory map Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 55/58] MIPS: malta: malta-memory: Add free_init_pages_eva() callback Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 56/58] MIPS: malta: malta-init: Fix System Controller memory mapping for EVA Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 57/58] MIPS: malta: Add support for SMP EVA Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-27 20:19 ` [PATCH 58/58] MIPS: Enable MIPS 3.5 features on Malta Markos Chandras
2014-01-27 20:19   ` Markos Chandras
2014-01-29 18:37 ` [PATCH 00/58] Add support for Enhanced Virtual Addressing David Daney
2014-02-04  9:00   ` Markos Chandras [this message]
2014-02-04  9:00     ` Markos Chandras

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52F0AC3E.5050806@imgtec.com \
    --to=markos.chandras@imgtec.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=linux-mips@linux-mips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.