From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZE1fr-0007Zu-5X for qemu-devel@nongnu.org; Sat, 11 Jul 2015 16:47:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZE1fm-00015V-6a for qemu-devel@nongnu.org; Sat, 11 Jul 2015 16:47:03 -0400 Received: from mail-yk0-f179.google.com ([209.85.160.179]:36027) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZE1fm-00015J-1v for qemu-devel@nongnu.org; Sat, 11 Jul 2015 16:46:58 -0400 Received: by ykay190 with SMTP id y190so11934861yka.3 for ; Sat, 11 Jul 2015 13:46:57 -0700 (PDT) MIME-Version: 1.0 Sender: peter.crosthwaite@petalogix.com Date: Sat, 11 Jul 2015 13:46:57 -0700 Message-ID: From: Peter Crosthwaite Content-Type: text/plain; charset=UTF-8 Subject: [Qemu-devel] Semantics of tcg_enabled() and what it means for multi-arch List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , Richard Henderson , "qemu-devel@nongnu.org Developers" Hi Paolo, Richard and all, What is the exact semantic of tcg_enabled() supposed to be and is it ill-defined in multi-arch? Currently, tcg_enabled is defined as: bool tcg_enabled(void) { return tcg_ctx.code_gen_buffer != NULL; } In the multi-arch work, the tcg_ctx is now multiple per-arch. So lets assume that we virtualise tcg_enabled as a CPU hook. This handles a good number of cases, where there is a sense of a current CPU to which the tcg_enabled is being queried. All uses in target-foo are trivially handled as they will link against their local tcg_enabled implementation. This per-cpu approach has the added advantage of preparing support for mixed KVM/TCG multi-arch systems. But tcg_enabled() is used in the memory API for dirty code tracking where there is no sense of a current tcg_ctx: include/exec/ram_addr.h: if (tcg_enabled()) { include/exec/ram_addr.h: uint8_t clients = tcg_enabled() ? DIRTY_CLIENTS_ALL : DIRTY_CLIENTS_NOCODE; memory.c: mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0; memory.c: mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0; memory.c: mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0; memory.c: mr->dirty_log_mask = tcg_enabled() ? (1 << DIRTY_MEMORY_CODE) : 0; So what is the correct logic for populating dirty_log_mask and friends when there are 0. 1, or more TCG engines? Regards, Peter