public inbox for linux-sh@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Mundt <lethal@linux-sh.org>
To: linux-sh@vger.kernel.org
Subject: Re: needs writeback on ptrace
Date: Fri, 15 Feb 2008 05:29:13 +0000	[thread overview]
Message-ID: <20080215052913.GA22905@linux-sh.org> (raw)
In-Reply-To: <20080215.095254.68562685.saito@densan.co.jp>

On Fri, Feb 15, 2008 at 09:52:54AM +0900, Hideo Saito wrote:
> Hi Paul,
> 
> When I test gdb on linux-2.6.24 for SH7780, the gdb can't step the program.
> I think inserted breakpoints can't write back to the physical memory.
> 
> Following changes is available for this problem.
> 
> --- ./arch/sh/mm/pg-sh4.c.org	2008-01-25 07:58:37.000000000 +0900
> +++ ./arch/sh/mm/pg-sh4.c	2008-02-06 17:19:58.000000000 +0900
> @@ -87,18 +109,21 @@ void copy_to_user_page(struct vm_area_st
>  	void *vto;
>  
>  	__set_bit(PG_mapped, &page->flags);
>  
>  	vto = kmap_coherent(page, vaddr) + (vaddr & ~PAGE_MASK);
>  	memcpy(vto, src, len);
>  	kunmap_coherent(vto);
>  
> -	if (vma->vm_flags & VM_EXEC)
> -		flush_cache_page(vma, vaddr, page_to_pfn(page));
> +	if (vma->vm_flags & VM_EXEC) {
> +		extern void __flush_invalidate_region_icache(void *start, int size);
> +		__flush_wback_region(vto, len);
> +		__flush_invalidate_region_icache(vto, len);
> +	}
>  }
>  
Two problems here, one is that you're trying to use vto outside of the
path where it's mapped (so the logic at least needs to be moved after the
memcpy() and before the kunmap_coherent(), and the other issue is that
this is precisely what flush_cache_page() is doing already. If
flush_cache_page() isn't working in this case, it's important to figure
out why that's so, rather than trying to side-step it with these
__flush_xxx() routines.

How does something like:

	vto = ...
	memcpy

	if (vma->vm_flags & VM_EXEC)
		flush_cache_page(vma, (unsigned long)vto, page_to_pfn(page));
	
	kunmap_coherent(vto);

work?

  reply	other threads:[~2008-02-15  5:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15  0:52 needs writeback on ptrace Hideo Saito
2008-02-15  5:29 ` Paul Mundt [this message]
2008-02-15  7:40 ` Hideo Saito
2008-02-15  7:56 ` Paul Mundt
2008-02-15  9:10 ` Hideo Saito

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=20080215052913.GA22905@linux-sh.org \
    --to=lethal@linux-sh.org \
    --cc=linux-sh@vger.kernel.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