pmap_pte_set() is not supposed to be atomic, so only raise IPL, no need to take pte_lockdiff -r1.30 -r1.31 src/sys/arch/amd64/include/pmap.h
(bouyer)
--- src/sys/arch/amd64/include/pmap.h 2012/01/15 16:48:31 1.30
+++ src/sys/arch/amd64/include/pmap.h 2012/01/19 22:00:56 1.31
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pmap.h,v 1.30 2012/01/15 16:48:31 cherry Exp $ */ | 1 | /* $NetBSD: pmap.h,v 1.31 2012/01/19 22:00:56 bouyer Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997 Charles D. Cranor and Washington University. | 4 | * Copyright (c) 1997 Charles D. Cranor and Washington University. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -268,29 +268,29 @@ static __inline pt_entry_t | @@ -268,29 +268,29 @@ static __inline pt_entry_t | |||
268 | pmap_pa2pte(paddr_t pa) | 268 | pmap_pa2pte(paddr_t pa) | |
269 | { | 269 | { | |
270 | return (pt_entry_t)xpmap_ptom_masked(pa); | 270 | return (pt_entry_t)xpmap_ptom_masked(pa); | |
271 | } | 271 | } | |
272 | 272 | |||
273 | static __inline paddr_t | 273 | static __inline paddr_t | |
274 | pmap_pte2pa(pt_entry_t pte) | 274 | pmap_pte2pa(pt_entry_t pte) | |
275 | { | 275 | { | |
276 | return xpmap_mtop_masked(pte & PG_FRAME); | 276 | return xpmap_mtop_masked(pte & PG_FRAME); | |
277 | } | 277 | } | |
278 | static __inline void | 278 | static __inline void | |
279 | pmap_pte_set(pt_entry_t *pte, pt_entry_t npte) | 279 | pmap_pte_set(pt_entry_t *pte, pt_entry_t npte) | |
280 | { | 280 | { | |
281 | mutex_enter(&pte_lock); | 281 | int s = splvm(); | |
282 | xpq_queue_pte_update(xpmap_ptetomach(pte), npte); | 282 | xpq_queue_pte_update(xpmap_ptetomach(pte), npte); | |
283 | mutex_exit(&pte_lock); | 283 | splx(s); | |
284 | } | 284 | } | |
285 | 285 | |||
286 | static __inline pt_entry_t | 286 | static __inline pt_entry_t | |
287 | pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n) | 287 | pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n) | |
288 | { | 288 | { | |
289 | pt_entry_t opte; | 289 | pt_entry_t opte; | |
290 | 290 | |||
291 | mutex_enter(&pte_lock); | 291 | mutex_enter(&pte_lock); | |
292 | opte = *ptep; | 292 | opte = *ptep; | |
293 | if (opte == o) { | 293 | if (opte == o) { | |
294 | xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n); | 294 | xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n); | |
295 | xpq_flush_queue(); | 295 | xpq_flush_queue(); | |
296 | } | 296 | } |
--- src/sys/arch/i386/include/pmap.h 2012/01/09 13:04:13 1.113
+++ src/sys/arch/i386/include/pmap.h 2012/01/19 22:00:57 1.114
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pmap.h,v 1.113 2012/01/09 13:04:13 cherry Exp $ */ | 1 | /* $NetBSD: pmap.h,v 1.114 2012/01/19 22:00:57 bouyer Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 1997 Charles D. Cranor and Washington University. | 4 | * Copyright (c) 1997 Charles D. Cranor and Washington University. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -360,29 +360,29 @@ static __inline pt_entry_t | @@ -360,29 +360,29 @@ static __inline pt_entry_t | |||
360 | pmap_pa2pte(paddr_t pa) | 360 | pmap_pa2pte(paddr_t pa) | |
361 | { | 361 | { | |
362 | return (pt_entry_t)xpmap_ptom_masked(pa); | 362 | return (pt_entry_t)xpmap_ptom_masked(pa); | |
363 | } | 363 | } | |
364 | 364 | |||
365 | static __inline paddr_t | 365 | static __inline paddr_t | |
366 | pmap_pte2pa(pt_entry_t pte) | 366 | pmap_pte2pa(pt_entry_t pte) | |
367 | { | 367 | { | |
368 | return xpmap_mtop_masked(pte & PG_FRAME); | 368 | return xpmap_mtop_masked(pte & PG_FRAME); | |
369 | } | 369 | } | |
370 | static __inline void | 370 | static __inline void | |
371 | pmap_pte_set(pt_entry_t *pte, pt_entry_t npte) | 371 | pmap_pte_set(pt_entry_t *pte, pt_entry_t npte) | |
372 | { | 372 | { | |
373 | mutex_enter(&pte_lock); | 373 | int s = splvm(); | |
374 | xpq_queue_pte_update(xpmap_ptetomach(pte), npte); | 374 | xpq_queue_pte_update(xpmap_ptetomach(pte), npte); | |
375 | mutex_exit(&pte_lock); | 375 | splx(s); | |
376 | } | 376 | } | |
377 | 377 | |||
378 | static __inline pt_entry_t | 378 | static __inline pt_entry_t | |
379 | pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n) | 379 | pmap_pte_cas(volatile pt_entry_t *ptep, pt_entry_t o, pt_entry_t n) | |
380 | { | 380 | { | |
381 | pt_entry_t opte; | 381 | pt_entry_t opte; | |
382 | 382 | |||
383 | mutex_enter(&pte_lock); | 383 | mutex_enter(&pte_lock); | |
384 | opte = *ptep; | 384 | opte = *ptep; | |
385 | if (opte == o) { | 385 | if (opte == o) { | |
386 | xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n); | 386 | xpq_queue_pte_update(xpmap_ptetomach(__UNVOLATILE(ptep)), n); | |
387 | xpq_flush_queue(); | 387 | xpq_flush_queue(); | |
388 | } | 388 | } |