MTTCG regression fixes for rc2
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJY2jLeAAoJEPvQ2wlanipED3sH/R1rexS6OKyKannz5SrqxgxK l3oD/OxBLT1KsBRxAtu7g6RR84Mzjfp5ILAYcDLv97uG8Y5AaVVhXXxv3HsDRE5E US95v5J6ZjqYwDs2ryNtDO27GDF56TAx8nfpX7kxkxRM7E9GSEYjrQSkwebOkYrA svdu1TpYYC++QlUcAe7rQCAoPRE4KbaorADiPw/6NJmq4fr0hMLZ0Cjsi+RaSpn8 lkyJNlyQl3cHnFPDJInm3V+kX6kaEF/O/fDQHCWB30IbkE1cVrL7/1E21eaqf46M 94CtkowSnCmC6zoGmZO7Nci6emyzlv3SUeQL2AmdcVURZlNncdtuzmPaqeEDmwk= =d0OM -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/stsquad/tags/pull-mttcg-fixups-for-rc2-280317-1' into staging MTTCG regression fixes for rc2 # gpg: Signature made Tue 28 Mar 2017 10:54:38 BST # gpg: using RSA key 0xFBD0DB095A9E2A44 # gpg: Good signature from "Alex Bennée (Master Work Key) <alex.bennee@linaro.org>" # Primary key fingerprint: 6685 AE99 E751 67BC AFC8 DF35 FBD0 DB09 5A9E 2A44 * remotes/stsquad/tags/pull-mttcg-fixups-for-rc2-280317-1: replay/replay.c: bump REPLAY_VERSION tcg: Add a new line after incompatibility warning ui/console: use exclusive mechanism directly ui/console: ensure do_safe_dpy_refresh holds BQL bsd-user: align use of mmap_lock to that of linux-user user-exec: handle synchronous signals from QEMU gracefully Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
		
						commit
						0491c22154
					
				@ -24,8 +24,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//#define DEBUG_MMAP
 | 
					//#define DEBUG_MMAP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(CONFIG_USE_NPTL)
 | 
					static pthread_mutex_t mmap_mutex = PTHREAD_MUTEX_INITIALIZER;
 | 
				
			||||||
pthread_mutex_t mmap_mutex;
 | 
					 | 
				
			||||||
static int __thread mmap_lock_count;
 | 
					static int __thread mmap_lock_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void mmap_lock(void)
 | 
					void mmap_lock(void)
 | 
				
			||||||
@ -62,16 +61,6 @@ void mmap_fork_end(int child)
 | 
				
			|||||||
    else
 | 
					    else
 | 
				
			||||||
        pthread_mutex_unlock(&mmap_mutex);
 | 
					        pthread_mutex_unlock(&mmap_mutex);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
/* We aren't threadsafe to start with, so no need to worry about locking.  */
 | 
					 | 
				
			||||||
void mmap_lock(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void mmap_unlock(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* NOTE: all the constants are the HOST ones, but addresses are target. */
 | 
					/* NOTE: all the constants are the HOST ones, but addresses are target. */
 | 
				
			||||||
int target_mprotect(abi_ulong start, abi_ulong len, int prot)
 | 
					int target_mprotect(abi_ulong start, abi_ulong len, int prot)
 | 
				
			||||||
 | 
				
			|||||||
@ -209,10 +209,8 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
 | 
				
			|||||||
                       abi_ulong new_addr);
 | 
					                       abi_ulong new_addr);
 | 
				
			||||||
int target_msync(abi_ulong start, abi_ulong len, int flags);
 | 
					int target_msync(abi_ulong start, abi_ulong len, int flags);
 | 
				
			||||||
extern unsigned long last_brk;
 | 
					extern unsigned long last_brk;
 | 
				
			||||||
#if defined(CONFIG_USE_NPTL)
 | 
					 | 
				
			||||||
void mmap_fork_start(void);
 | 
					void mmap_fork_start(void);
 | 
				
			||||||
void mmap_fork_end(int child);
 | 
					void mmap_fork_end(int child);
 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* main.c */
 | 
					/* main.c */
 | 
				
			||||||
extern unsigned long x86_stack_size;
 | 
					extern unsigned long x86_stack_size;
 | 
				
			||||||
 | 
				
			|||||||
@ -35,7 +35,7 @@ void cpu_loop_exit_noexc(CPUState *cpu)
 | 
				
			|||||||
#if defined(CONFIG_SOFTMMU)
 | 
					#if defined(CONFIG_SOFTMMU)
 | 
				
			||||||
void cpu_reloading_memory_map(void)
 | 
					void cpu_reloading_memory_map(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if (qemu_in_vcpu_thread()) {
 | 
					    if (qemu_in_vcpu_thread() && current_cpu->running) {
 | 
				
			||||||
        /* The guest can in theory prolong the RCU critical section as long
 | 
					        /* The guest can in theory prolong the RCU critical section as long
 | 
				
			||||||
         * as it feels like. The major problem with this is that because it
 | 
					         * as it feels like. The major problem with this is that because it
 | 
				
			||||||
         * can do multiple reconfigurations of the memory map within the
 | 
					         * can do multiple reconfigurations of the memory map within the
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								cpus.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								cpus.c
									
									
									
									
									
								
							@ -209,7 +209,7 @@ void qemu_tcg_configure(QemuOpts *opts, Error **errp)
 | 
				
			|||||||
                if (!check_tcg_memory_orders_compatible()) {
 | 
					                if (!check_tcg_memory_orders_compatible()) {
 | 
				
			||||||
                    error_report("Guest expects a stronger memory ordering "
 | 
					                    error_report("Guest expects a stronger memory ordering "
 | 
				
			||||||
                                 "than the host provides");
 | 
					                                 "than the host provides");
 | 
				
			||||||
                    error_printf("This may cause strange/hard to debug errors");
 | 
					                    error_printf("This may cause strange/hard to debug errors\n");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
                mttcg_enabled = true;
 | 
					                mttcg_enabled = true;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
@ -22,7 +22,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/* Current version of the replay mechanism.
 | 
					/* Current version of the replay mechanism.
 | 
				
			||||||
   Increase it when file format changes. */
 | 
					   Increase it when file format changes. */
 | 
				
			||||||
#define REPLAY_VERSION              0xe02005
 | 
					#define REPLAY_VERSION              0xe02006
 | 
				
			||||||
/* Size of replay log header */
 | 
					/* Size of replay log header */
 | 
				
			||||||
#define HEADER_SIZE                 (sizeof(uint32_t) + sizeof(uint64_t))
 | 
					#define HEADER_SIZE                 (sizeof(uint32_t) + sizeof(uint64_t))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										18
									
								
								ui/console.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								ui/console.c
									
									
									
									
									
								
							@ -1576,17 +1576,22 @@ bool dpy_gfx_check_format(QemuConsole *con,
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Safe DPY refresh for TCG guests. This runs when the TCG vCPUs are
 | 
					 * Safe DPY refresh for TCG guests. We use the exclusive mechanism to
 | 
				
			||||||
 * quiescent so we can avoid races between dirty page tracking for
 | 
					 * ensure the TCG vCPUs are quiescent so we can avoid races between
 | 
				
			||||||
 * direct frame-buffer access by the guest.
 | 
					 * dirty page tracking for direct frame-buffer access by the guest.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * This is a temporary stopgap until we've fixed the dirty tracking
 | 
					 * This is a temporary stopgap until we've fixed the dirty tracking
 | 
				
			||||||
 * races in display adapters.
 | 
					 * races in display adapters.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
static void do_safe_dpy_refresh(CPUState *cpu, run_on_cpu_data opaque)
 | 
					static void do_safe_dpy_refresh(DisplayChangeListener *dcl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    DisplayChangeListener *dcl = opaque.host_ptr;
 | 
					    qemu_mutex_unlock_iothread();
 | 
				
			||||||
 | 
					    start_exclusive();
 | 
				
			||||||
 | 
					    qemu_mutex_lock_iothread();
 | 
				
			||||||
    dcl->ops->dpy_refresh(dcl);
 | 
					    dcl->ops->dpy_refresh(dcl);
 | 
				
			||||||
 | 
					    qemu_mutex_unlock_iothread();
 | 
				
			||||||
 | 
					    end_exclusive();
 | 
				
			||||||
 | 
					    qemu_mutex_lock_iothread();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void dpy_refresh(DisplayState *s)
 | 
					static void dpy_refresh(DisplayState *s)
 | 
				
			||||||
@ -1596,8 +1601,7 @@ static void dpy_refresh(DisplayState *s)
 | 
				
			|||||||
    QLIST_FOREACH(dcl, &s->listeners, next) {
 | 
					    QLIST_FOREACH(dcl, &s->listeners, next) {
 | 
				
			||||||
        if (dcl->ops->dpy_refresh) {
 | 
					        if (dcl->ops->dpy_refresh) {
 | 
				
			||||||
            if (tcg_enabled()) {
 | 
					            if (tcg_enabled()) {
 | 
				
			||||||
                async_safe_run_on_cpu(first_cpu, do_safe_dpy_refresh,
 | 
					                do_safe_dpy_refresh(dcl);
 | 
				
			||||||
                                      RUN_ON_CPU_HOST_PTR(dcl));
 | 
					 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                dcl->ops->dpy_refresh(dcl);
 | 
					                dcl->ops->dpy_refresh(dcl);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										18
									
								
								user-exec.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								user-exec.c
									
									
									
									
									
								
							@ -57,10 +57,23 @@ static void cpu_exit_tb_from_sighandler(CPUState *cpu, sigset_t *old_set)
 | 
				
			|||||||
static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 | 
					static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 | 
				
			||||||
                                    int is_write, sigset_t *old_set)
 | 
					                                    int is_write, sigset_t *old_set)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    CPUState *cpu;
 | 
					    CPUState *cpu = current_cpu;
 | 
				
			||||||
    CPUClass *cc;
 | 
					    CPUClass *cc;
 | 
				
			||||||
    int ret;
 | 
					    int ret;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /* For synchronous signals we expect to be coming from the vCPU
 | 
				
			||||||
 | 
					     * thread (so current_cpu should be valid) and either from running
 | 
				
			||||||
 | 
					     * code or during translation which can fault as we cross pages.
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * If neither is true then something has gone wrong and we should
 | 
				
			||||||
 | 
					     * abort rather than try and restart the vCPU execution.
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    if (!cpu || !cpu->running) {
 | 
				
			||||||
 | 
					        printf("qemu:%s received signal outside vCPU context @ pc=0x%"
 | 
				
			||||||
 | 
					               PRIxPTR "\n",  __func__, pc);
 | 
				
			||||||
 | 
					        abort();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(DEBUG_SIGNAL)
 | 
					#if defined(DEBUG_SIGNAL)
 | 
				
			||||||
    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
 | 
					    printf("qemu: SIGSEGV pc=0x%08lx address=%08lx w=%d oldset=0x%08lx\n",
 | 
				
			||||||
           pc, address, is_write, *(unsigned long *)old_set);
 | 
					           pc, address, is_write, *(unsigned long *)old_set);
 | 
				
			||||||
@ -83,7 +96,7 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 | 
				
			|||||||
             * currently executing TB was modified and must be exited
 | 
					             * currently executing TB was modified and must be exited
 | 
				
			||||||
             * immediately.
 | 
					             * immediately.
 | 
				
			||||||
             */
 | 
					             */
 | 
				
			||||||
            cpu_exit_tb_from_sighandler(current_cpu, old_set);
 | 
					            cpu_exit_tb_from_sighandler(cpu, old_set);
 | 
				
			||||||
            g_assert_not_reached();
 | 
					            g_assert_not_reached();
 | 
				
			||||||
        default:
 | 
					        default:
 | 
				
			||||||
            g_assert_not_reached();
 | 
					            g_assert_not_reached();
 | 
				
			||||||
@ -94,7 +107,6 @@ static inline int handle_cpu_signal(uintptr_t pc, unsigned long address,
 | 
				
			|||||||
       are still valid segv ones */
 | 
					       are still valid segv ones */
 | 
				
			||||||
    address = h2g_nocheck(address);
 | 
					    address = h2g_nocheck(address);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cpu = current_cpu;
 | 
					 | 
				
			||||||
    cc = CPU_GET_CLASS(cpu);
 | 
					    cc = CPU_GET_CLASS(cpu);
 | 
				
			||||||
    /* see if it is an MMU fault */
 | 
					    /* see if it is an MMU fault */
 | 
				
			||||||
    g_assert(cc->handle_mmu_fault);
 | 
					    g_assert(cc->handle_mmu_fault);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user