qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Max Filippov <jcmvbkbc@gmail.com>
Cc: Blue Swirl <blauwirbel@gmail.com>, TeLeMan <geleman@gmail.com>,
	qemu-devel <qemu-devel@nongnu.org>, Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] TCG: Fix TB invalidation after breakpoint insertion/deletion
Date: Thu, 24 May 2012 10:26:46 -0300	[thread overview]
Message-ID: <4FBE3716.6040205@siemens.com> (raw)
In-Reply-To: <CAMo8BfK-9b5c=dNh1bA7NaXY-a9N1Yu6=OShTjMdLa1vyDMSZA@mail.gmail.com>

On 2012-05-24 09:42, Max Filippov wrote:
> On Thu, May 24, 2012 at 4:16 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>> On 2012-05-24 09:08, Max Filippov wrote:
>>> On Thu, May 24, 2012 at 3:25 PM, Jan Kiszka <jan.kiszka@siemens.com> wrote:
>>>> On 2012-05-24 07:51, Max Filippov wrote:
>>>>> On Thu, May 24, 2012 at 6:34 AM, Jan Kiszka <jan.kiszka@web.de> wrote:
>>>>>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>>>>>
>>>>>> tb_invalidate_phys_addr has to called with the exact physical address of
>>>>>> the breakpoint we add/remove, not just the page's base address.
>>>>>> Otherwise we easily fail to flush the right TB.
>>>>>>
>>>>>> Regression of 1e7855a558.
>>>>>
>>>>> Sorry, I fail to see how 1e7855a558 could introduce a regression, it
>>>>> just rearranged the code.
>>>>> Even more, AFAIK cpu_get_phys_page_debug returns complete physical
>>>>> address, not just
>>>>> physical page. Probably it has a misleading name.
>>>>
>>>> Unfortunately, cpu_get_phys_page_debug does NOT deliver the sub-page
>>>> offset, only the page base address.
>>>
>>> Ok, i386 has probably the most explicit implementation,
>>> let's look at the target-i386/helper.c:876
>>>
>>>     page_offset = (addr & TARGET_PAGE_MASK) & (page_size - 1);
>>>     paddr = (pte & TARGET_PAGE_MASK) + page_offset;
>>>     return paddr;
>>>
>>> that's clearly physical page plus in-page offset.
>>> I can provide other samples (:
>>
>> "page_offset" is misleading: addr & TARGET_PAGE_MASK kills all the
>> offset bits. It will only contain the relevant bits between page_size
>> and TARGET_PAGE_SIZE.
>>
>> Check also ppc's cpu_get_phys_page_debug, it's clearer in this regard.
> 
> Ok, for i386, ppc, microblaze (and maybe others) you're right.
> What about ARM, CRIS, MIPS, SH4, xtensa (and maybe others)?
> Looks like this is a long-standing discrepancy and consequently
> a long-standing bug in the breakpoint_invalidate.

Not in breakpoint_invalidate as the missing offset was compensated
before your commit (well, starting with c2f07f81a2 in fact).

But it looks like cpu_get_phys_page_debug was broken for quite a while.
Let's fix those archs to return more than page-aligned addresses.

Jan

-- 
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux

  reply	other threads:[~2012-05-24 13:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-24  2:34 [Qemu-devel] [PATCH] TCG: Fix TB invalidation after breakpoint insertion/deletion Jan Kiszka
2012-05-24  2:44 ` Jan Kiszka
2012-05-24 10:51 ` Max Filippov
2012-05-24 11:25   ` Jan Kiszka
2012-05-24 12:08     ` Max Filippov
2012-05-24 12:16       ` Jan Kiszka
2012-05-24 12:42         ` Max Filippov
2012-05-24 13:26           ` Jan Kiszka [this message]
2012-05-24 14:11             ` Max Filippov
2012-05-24 14:21               ` Jan Kiszka
2012-05-24 14:29                 ` Max Filippov
2012-05-24 14:34                   ` Jan Kiszka
2012-05-24 14:26               ` Avi Kivity
2012-05-24 19:58                 ` Max Filippov
2012-05-28  9:34                   ` Avi Kivity
2012-05-28 11:54                     ` Max Filippov
2012-05-28 12:04                       ` Avi Kivity

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=4FBE3716.6040205@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=geleman@gmail.com \
    --cc=jcmvbkbc@gmail.com \
    --cc=qemu-devel@nongnu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).