From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35491) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj76V-0007h7-6h for qemu-devel@nongnu.org; Thu, 24 Mar 2016 11:23:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aj76Q-0004q0-6z for qemu-devel@nongnu.org; Thu, 24 Mar 2016 11:23:19 -0400 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]:35032) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aj76Q-0004pp-0j for qemu-devel@nongnu.org; Thu, 24 Mar 2016 11:23:14 -0400 Received: by mail-wm0-x22c.google.com with SMTP id l68so241425233wml.0 for ; Thu, 24 Mar 2016 08:23:13 -0700 (PDT) References: <1458815961-31979-1-git-send-email-sergey.fedorov@linaro.org> <1458815961-31979-2-git-send-email-sergey.fedorov@linaro.org> <87poukq9fk.fsf@linaro.org> <56F3F377.4070809@gmail.com> <87mvpnrkby.fsf@linaro.org> <56F4039A.5050907@redhat.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <56F4039A.5050907@redhat.com> Date: Thu, 24 Mar 2016 15:23:11 +0000 Message-ID: <87io0brjc0.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 1/8] tcg: Clean up direct block chaining data fields List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: sergey.fedorov@linaro.org, Peter Crosthwaite , Stefan Weil , Claudio Fontana , qemu-devel@nongnu.org, Alexander Graf , Blue Swirl , qemu-arm@nongnu.org, "Vassili Karpov (malc)" , Sergey Fedorov , Aurelien Jarno , Richard Henderson Paolo Bonzini writes: > On 24/03/2016 16:01, Alex Bennée wrote: >>>> >> OK I found that tricky to follow. Where does the value of the pointer >>>> >> come from that sets these bottom bits? The TB jumping to this TB sets it? >> >> Where I get confused it what is the point of jmp_list_first? If these >> are two circular lists do we care which the first in the list is? The >> exit condition when coming out of searching seems when ntb with index = >> orig tb with index. > > Say you have a list for blocks that jump to TB. The next pointer is in > jmp_list_next[0] for blocks whose first jump is to TB. It is in > jmp_list_next[1] for blocks whose second jump is to TB. > > However, because it is a circular list, you also need TB itself to be a > part of the list. For TB, the next pointer is in jmp_list_first. > > Because TB probably doesn't jump to itself, the first link of the list > of blocks that jumps to TB is not in jmp_list_next[]. Thus QEMU places > it in tb->jmp_list_first. > > Say you have three tbs. TB1's first jump and TB2's second jump lead to > TB0. Then the list starting at tb0->jmp_list_first goes like this: > > tb0->jmp_list_first = tb1 | 0; > .--------------------' | > | .--------' > tb1->jmp_list_next[0] = tb2 | 1; > .--------------------' | > | .---------' > tb2->jmp_list_next[1] = tb0 | 2; > > There is also a case where a TB jumps to itself; it then appears twice > in the list with different values in the low bits, such as this: > > tb->jmp_list_first = tb | 0; > .--------------------' | > | .-------' > tb->jmp_list_next[0] = tb | 2; > > Other blocks jumping to TB would appear in the same list, too, either > before or after the tb|0 link. Right I follow now. Extra ascii art always helps ;-) -- Alex Bennée