7312 } |
7312 } |
7313 |
7313 |
7314 void |
7314 void |
7315 i_ddi_di_cache_invalidate(int kmflag) |
7315 i_ddi_di_cache_invalidate(int kmflag) |
7316 { |
7316 { |
7317 uint_t flag; |
7317 int cache_valid; |
7318 |
7318 |
7319 if (!modrootloaded || !i_ddi_io_initialized()) { |
7319 if (!modrootloaded || !i_ddi_io_initialized()) { |
7320 if (di_cache_debug) |
7320 if (di_cache_debug) |
7321 cmn_err(CE_NOTE, "I/O not inited. Skipping invalidate"); |
7321 cmn_err(CE_NOTE, "I/O not inited. Skipping invalidate"); |
7322 return; |
7322 return; |
7323 } |
7323 } |
7324 |
7324 |
7325 /* |
7325 /* Increment devtree generation number. */ |
7326 * Invalidate the in-core cache and |
|
7327 * increment devtree generation number |
|
7328 */ |
|
7329 atomic_and_32(&di_cache.cache_valid, 0); |
|
7330 atomic_inc_ulong(&devtree_gen); |
7326 atomic_inc_ulong(&devtree_gen); |
7331 |
7327 |
7332 flag = (kmflag == KM_SLEEP) ? TQ_SLEEP : TQ_NOSLEEP; |
7328 /* Invalidate the in-core cache and dispatch free on valid->invalid */ |
7333 |
7329 cache_valid = atomic_swap_uint(&di_cache.cache_valid, 0); |
7334 (void) taskq_dispatch(system_taskq, free_cache_task, NULL, flag); |
7330 if (cache_valid) { |
|
7331 (void) taskq_dispatch(system_taskq, free_cache_task, NULL, |
|
7332 (kmflag == KM_SLEEP) ? TQ_SLEEP : TQ_NOSLEEP); |
|
7333 } |
7335 |
7334 |
7336 if (di_cache_debug) { |
7335 if (di_cache_debug) { |
7337 cmn_err(CE_NOTE, "invalidation with km_flag: %s", |
7336 cmn_err(CE_NOTE, "invalidation with km_flag: %s", |
7338 kmflag == KM_SLEEP ? "KM_SLEEP" : "KM_NOSLEEP"); |
7337 kmflag == KM_SLEEP ? "KM_SLEEP" : "KM_NOSLEEP"); |
7339 } |
7338 } |