Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: ddb fails to write breakpoint



On Tue, May 01, 2012 at 03:25:17AM +0200, Jean-Yves Migeon wrote:
> Le 30/04/12 23:24, David Laight a ?crit :
> >I tried to set a kerneld db breakpoint on amd64 current (6.99.6) but the
> >system just dumped - couldn't see why since it all scrolled away.
> >
> >Attempts to write into code space fault in ddb.
> >The following makes it work - but is clearly ott.
> >
> >--- arch/amd64/amd64/db_memrw.c 23 Nov 2011 01:15:02 -0000      1.9
> >+++ arch/amd64/amd64/db_memrw.c 30 Apr 2012 20:49:21 -0000
> >@@ -146,6 +146,7 @@ db_write_text(vaddr_t addr, size_t size,
> >             pmap_pte_clearbits(ppte, PG_KR);
> >             pmap_pte_setbits(ppte, PG_KW);
> >             pmap_update_pg(pgva);
> >+            tlbflushg();
> >
> >             /*
> >              * Page is now writable.  Do as much access as we
> >@@ -160,6 +161,7 @@ db_write_text(vaddr_t addr, size_t size,
> >             pmap_pte_clearbits(ppte, PG_KW);
> >             pmap_pte_setbits(ppte, PG_KR);
> >             pmap_update_pg(pgva);
> >+            tlbflushg();
> >
> >     } while (size != 0);
> >  }
> >
> >pmap_update_pg(addr) is just the single instruction 'invlpg adddr'
> >tlbflushg() is a full tlb zap.
> >
> >Not looked at what invlpg is supposed to do, or whether it is
> >an adequate synchronising instruction.
> >
> >cpu is an intel i7.
> 
> It should handle the invalidation fine, even if it is a global mapping.
> 
> Just tested it with a 6.99.4 kernel and worked fine, will test with a 
> more recent one.
> 
> Do you know whether it happens every time or just for specific addresses 
> (like one close to a page boundary or with the PG_PS bit set?)

Didn't dump the PTE contents.

I was trying to put a breakpoint onto netbsd32_sendsig which is a
'nowhere specific' code address (and didn't happen to be a page boundary).
Even with my change, I still saw a 'fault inside ddb' message when
I continued from the breakpoint - didn't look to see exactly where.

Might be cpu family related?
I disabled all but one of the cpu cores to make life less confusing!
made no difference.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index