All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>,
	Richard Henderson <richard.henderson@linaro.org>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 02/26] tcg: Add CPUClass::tlb_fill
Date: Wed, 8 May 2019 07:58:14 +0200	[thread overview]
Message-ID: <e675b3a8-5230-37a1-b7fa-4597d18b7ab8@redhat.com> (raw)
In-Reply-To: <CAFEAcA_=PiLXOn+H9=VAdXx-YKDbh0eZ83NDWw=TmbrqTmGn7g@mail.gmail.com>

On 4/29/19 7:25 PM, Peter Maydell wrote:
> On Wed, 3 Apr 2019 at 04:49, Richard Henderson
> <richard.henderson@linaro.org> wrote:
>>
>> This hook will replace the (user-only mode specific) handle_mmu_fault
>> hook, and the (system mode specific) tlb_fill function.
>>
>> The handle_mmu_fault hook was written as if there was a valid
>> way to recover from an mmu fault, and had 3 possible return states.
>> In reality, the only valid action is to raise an exception,
>> return to the main loop, and delver the SIGSEGV to the guest.
> 
> "deliver"
> 
> You might also mention here that all of the implementations
> of handle_mmu_fault for guest architectures which support
> linux-user do in fact only ever return 1.
> 
>>
>> Using the hook for system mode requires that all targets be converted,
>> so for now the hook is (optionally) used only from user-only mode.
>>
>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
>> ---
>>  include/qom/cpu.h     |  9 +++++++++
>>  accel/tcg/user-exec.c | 42 ++++++++++++++----------------------------
>>  2 files changed, 23 insertions(+), 28 deletions(-)
>>
>> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
>> index 1d6099e5d4..7e96a0aed3 100644
>> --- a/include/qom/cpu.h
>> +++ b/include/qom/cpu.h
>> @@ -119,6 +119,12 @@ struct TranslationBlock;
>>   *       will need to do more. If this hook is not implemented then the
>>   *       default is to call @set_pc(tb->pc).
>>   * @handle_mmu_fault: Callback for handling an MMU fault.
>> + * @tlb_fill: Callback for handling a softmmu tlb miss or user-only
>> + *       address fault.  For system mode, if the access is valid, call
>> + *       tlb_set_page and return true; if the access is invalid, and
>> + *       probe is true, return false; otherwise raise an exception and
>> + *       do not return.  For user-only mode, always raise an exception
>> + *       and do not return.
>>   * @get_phys_page_debug: Callback for obtaining a physical address.
>>   * @get_phys_page_attrs_debug: Callback for obtaining a physical address and the
>>   *       associated memory transaction attributes to use for the access.
>> @@ -194,6 +200,9 @@ typedef struct CPUClass {
>>      void (*synchronize_from_tb)(CPUState *cpu, struct TranslationBlock *tb);
>>      int (*handle_mmu_fault)(CPUState *cpu, vaddr address, int size, int rw,
>>                              int mmu_index);
>> +    bool (*tlb_fill)(CPUState *cpu, vaddr address, int size,
>> +                     MMUAccessType access_type, int mmu_idx,
>> +                     bool probe, uintptr_t retaddr);
>>      hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
>>      hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
>>                                          MemTxAttrs *attrs);
>> diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c
>> index fa9380a380..f13c0b2b67 100644
>> --- a/accel/tcg/user-exec.c
>> +++ b/accel/tcg/user-exec.c
>> @@ -65,6 +65,7 @@ static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info,
>>      CPUClass *cc;
>>      int ret;
>>      unsigned long address = (unsigned long)info->si_addr;
>> +    MMUAccessType access_type;
>>
>>      /* We must handle PC addresses from two different sources:
>>       * a call return address and a signal frame address.
>> @@ -151,40 +152,25 @@ static inline int handle_cpu_signal(uintptr_t pc, siginfo_t *info,
>>  #if TARGET_LONG_BITS == 32 && HOST_LONG_BITS == 64
>>      g_assert(h2g_valid(address));
>>  #endif
>> -
>> -    /* Convert forcefully to guest address space, invalid addresses
>> -       are still valid segv ones */
> 
> This comment is still valid so I don't think it should be deleted.
> 
>>      address = h2g_nocheck(address);
> 
> Otherwise
> 
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



  reply	other threads:[~2019-05-08  5:59 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-03  3:43 [Qemu-devel] [PATCH 00/26] tcg: Add CPUClass::tlb_fill Richard Henderson
2019-04-03  3:43 ` [Qemu-devel] [PATCH 01/26] tcg: Assert h2g_valid for 32-bit guest on 64-bit host Richard Henderson
2019-04-03  4:59   ` Peter Maydell
2019-04-03  7:30     ` Richard Henderson
2019-04-03  3:43 ` [Qemu-devel] [PATCH 02/26] tcg: Add CPUClass::tlb_fill Richard Henderson
2019-04-29 17:25   ` Peter Maydell
2019-05-08  5:58     ` Philippe Mathieu-Daudé [this message]
2019-04-03  3:43 ` [Qemu-devel] [PATCH 03/26] target/alpha: Convert to CPUClass::tlb_fill Richard Henderson
2019-04-29 17:47   ` Peter Maydell
2019-05-08  6:09   ` Philippe Mathieu-Daudé
2019-04-03  3:43 ` [Qemu-devel] [PATCH 04/26] target/arm: " Richard Henderson
2019-04-03  5:14   ` [Qemu-devel] [Qemu-arm] " Peter Maydell
2019-04-03  7:30     ` Richard Henderson
2019-04-30 12:02     ` Peter Maydell
2019-04-30 12:02       ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 05/26] target/cris: " Richard Henderson
2019-04-30 11:57   ` Peter Maydell
2019-04-30 11:57     ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 06/26] target/hppa: " Richard Henderson
2019-04-30 11:51   ` Peter Maydell
2019-05-08  6:07   ` Philippe Mathieu-Daudé
2019-04-03  3:43 ` [Qemu-devel] [PATCH 07/26] target/i386: " Richard Henderson
2019-04-30 11:49   ` Peter Maydell
2019-04-30 11:49     ` Peter Maydell
2019-04-30 14:52     ` Richard Henderson
2019-04-30 14:52       ` Richard Henderson
2019-04-03  3:43 ` [Qemu-devel] [PATCH 08/26] target/lm32: " Richard Henderson
2019-04-30 11:45   ` Peter Maydell
2019-04-30 11:45     ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 09/26] target/m68k: " Richard Henderson
2019-04-30 11:43   ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 10/26] target/microblaze: " Richard Henderson
2019-04-30 11:04   ` Peter Maydell
2019-04-30 11:04     ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 11/26] target/mips: " Richard Henderson
2019-04-30 10:57   ` Peter Maydell
2019-04-30 10:57     ` Peter Maydell
2019-05-08  5:55   ` Philippe Mathieu-Daudé
2019-04-03  3:43 ` [Qemu-devel] [PATCH 12/26] target/moxie: " Richard Henderson
2019-04-30 10:47   ` Peter Maydell
2019-04-30 10:47     ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 13/26] target/nios2: " Richard Henderson
2019-04-30  9:44   ` Peter Maydell
2019-04-30  9:44     ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 14/26] target/openrisc: " Richard Henderson
2019-04-30  9:31   ` Peter Maydell
2019-04-30  9:31     ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 15/26] target/ppc: " Richard Henderson
2019-04-30  9:35   ` Peter Maydell
2019-04-30  9:35     ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 16/26] target/riscv: " Richard Henderson
2019-04-03  3:43   ` [Qemu-riscv] " Richard Henderson
2019-04-03 23:02   ` [Qemu-devel] " Alistair Francis
2019-04-03 23:02     ` [Qemu-riscv] " Alistair Francis
2019-04-03  3:43 ` [Qemu-devel] [PATCH 17/26] target/s390x: " Richard Henderson
2019-04-03 11:17   ` David Hildenbrand
2019-05-09  1:53     ` Richard Henderson
2019-04-03  3:43 ` [Qemu-devel] [PATCH 18/26] target/sh4: " Richard Henderson
2019-04-29 17:59   ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 19/26] target/sparc: " Richard Henderson
2019-04-03  4:36   ` Richard Henderson
2019-04-03  3:43 ` [Qemu-devel] [PATCH 20/26] target/tilegx: " Richard Henderson
2019-04-30 10:01   ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 21/26] target/tricore: " Richard Henderson
2019-04-30 10:03   ` Peter Maydell
2019-04-30 10:03     ` Peter Maydell
2019-04-03  3:43 ` [Qemu-devel] [PATCH 22/26] target/unicore32: " Richard Henderson
2019-04-30 10:06   ` Peter Maydell
2019-04-30 10:06     ` Peter Maydell
2019-05-08  4:27     ` Guan Xuetao
2019-04-03  3:43 ` [Qemu-devel] [PATCH 23/26] target/xtensa: " Richard Henderson
2019-04-30 10:11   ` Peter Maydell
2019-04-30 10:11     ` Peter Maydell
2019-04-30 17:32     ` Max Filippov
2019-04-30 17:44       ` Richard Henderson
2019-04-30 18:14         ` Max Filippov
2019-04-30 21:07           ` Max Filippov
2019-05-09  0:47             ` Max Filippov
2019-04-03  3:43 ` [Qemu-devel] [PATCH 24/26] tcg: Use CPUClass::tlb_fill in cputlb.c Richard Henderson
2019-04-29 17:28   ` Peter Maydell
2019-05-08  6:02     ` Philippe Mathieu-Daudé
2019-04-03  3:43 ` [Qemu-devel] [PATCH 25/26] tcg: Remove CPUClass::handle_mmu_fault Richard Henderson
2019-04-29 17:29   ` Peter Maydell
2019-05-08  6:03   ` Philippe Mathieu-Daudé
2019-04-03  3:43 ` [Qemu-devel] [PATCH 26/26] tcg: Use tlb_fill probe from tlb_vaddr_to_host Richard Henderson
2019-04-29 17:41   ` Peter Maydell
2019-05-09  5:24     ` Richard Henderson
2019-05-09  8:56       ` Peter Maydell
2019-05-09 22:24         ` Richard Henderson

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=e675b3a8-5230-37a1-b7fa-4597d18b7ab8@redhat.com \
    --to=philmd@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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.