TO: Jack Miller <mille...@us.ibm.com> CC: Johannes Weiner <han...@cmpxchg.org> CC: Milton Miller <milt...@bga.com> CC: Andrew Morton <a...@linux-foundation.org> CC: Linux Memory Management List <linux...@kvack.org>
tree: git://git.cmpxchg.org/linux-mmotm.git master head: df25ba7db0775d87018e2cd92f26b9b087093840 commit: e0f24ccae6b51cffbc1f1ed6b6c2f401f3cbee31 [191/230] shm: allow exit_shm in parallel if only marking orphans reproduce: make C=1 CF=-D__CHECK_ENDIAN__ :::::: branch date: 8 hours ago :::::: commit date: 8 hours ago ipc/shm.c:493:31: sparse: implicit cast to nocast type ipc/shm.c:534:36: sparse: implicit cast to nocast type ipc/shm.c:545:36: sparse: implicit cast to nocast type ipc/shm.c:95:17: sparse: context imbalance in 'do_shm_rmid' - unexpected unlock ipc/shm.c:195:9: sparse: context imbalance in 'shm_open' - unexpected unlock ipc/shm.c:210:13: sparse: context imbalance in 'shm_destroy' - unexpected unlock ipc/shm.c:267:17: sparse: context imbalance in 'shm_close' - unexpected unlock ipc/shm.c:272:12: sparse: context imbalance in 'shm_try_destroy_orphaned' - different lock contexts for basic block >> ipc/shm.c:335:9: sparse: context imbalance in 'exit_shm' - different lock >> contexts for basic block arch/x86/include/asm/current.h:14:16: sparse: context imbalance in 'newseg' - unexpected unlock ipc/shm.c:827:9: sparse: context imbalance in 'shmctl_down' - different lock contexts for basic block ipc/shm.c:1205:17: sparse: context imbalance in 'do_shmat' - unexpected unlock git remote add mmotm git://git.cmpxchg.org/linux-mmotm.git git remote update mmotm git checkout e0f24ccae6b51cffbc1f1ed6b6c2f401f3cbee31 vim +/exit_shm +335 ipc/shm.c e0f24cca Jack Miller 2014-06-20 329 /* e0f24cca Jack Miller 2014-06-20 330 * Destroy all already created segments, that were not yet mapped, e0f24cca Jack Miller 2014-06-20 331 * and mark any mapped as orphan to cover the sysctl toggling. e0f24cca Jack Miller 2014-06-20 332 * Destroy is skipped if shm_may_destroy() returns false. e0f24cca Jack Miller 2014-06-20 333 */ d9a605e4 Davidlohr Bueso 2013-09-11 334 down_write(&shm_ids(ns).rwsem); e0f24cca Jack Miller 2014-06-20 @335 list_for_each_entry_safe(shp, n, &task->sysvshm.shm_clist, shm_clist) { e0f24cca Jack Miller 2014-06-20 336 shp->shm_creator = NULL; e0f24cca Jack Miller 2014-06-20 337 e0f24cca Jack Miller 2014-06-20 338 if (shm_may_destroy(ns, shp)) { e0f24cca Jack Miller 2014-06-20 339 shm_lock_by_ptr(shp); e0f24cca Jack Miller 2014-06-20 340 shm_destroy(ns, shp); e0f24cca Jack Miller 2014-06-20 341 } e0f24cca Jack Miller 2014-06-20 342 } e0f24cca Jack Miller 2014-06-20 343 e0f24cca Jack Miller 2014-06-20 344 /* Remove the list head from any segments still attached. */ 0f1b4f37 Jack Miller 2014-06-20 345 list_del(&task->sysvshm.shm_clist); d9a605e4 Davidlohr Bueso 2013-09-11 346 up_write(&shm_ids(ns).rwsem); ^1da177e Linus Torvalds 2005-04-16 347 } ^1da177e Linus Torvalds 2005-04-16 348 d0217ac0 Nick Piggin 2007-07-19 349 static int shm_fault(struct vm_area_struct *vma, struct vm_fault *vmf) bc56bba8 Eric W. Biederman 2007-02-20 350 { bc56bba8 Eric W. Biederman 2007-02-20 351 struct file *file = vma->vm_file; bc56bba8 Eric W. Biederman 2007-02-20 352 struct shm_file_data *sfd = shm_file_data(file); bc56bba8 Eric W. Biederman 2007-02-20 353 d0217ac0 Nick Piggin 2007-07-19 354 return sfd->vm_ops->fault(vma, vmf); bc56bba8 Eric W. Biederman 2007-02-20 355 } bc56bba8 Eric W. Biederman 2007-02-20 356 bc56bba8 Eric W. Biederman 2007-02-20 357 #ifdef CONFIG_NUMA d823e3e7 Adrian Bunk 2007-10-16 358 static int shm_set_policy(struct vm_area_struct *vma, struct mempolicy *new) bc56bba8 Eric W. Biederman 2007-02-20 359 { bc56bba8 Eric W. Biederman 2007-02-20 360 struct file *file = vma->vm_file; bc56bba8 Eric W. Biederman 2007-02-20 361 struct shm_file_data *sfd = shm_file_data(file); bc56bba8 Eric W. Biederman 2007-02-20 362 int err = 0; bc56bba8 Eric W. Biederman 2007-02-20 363 if (sfd->vm_ops->set_policy) bc56bba8 Eric W. Biederman 2007-02-20 364 err = sfd->vm_ops->set_policy(vma, new); bc56bba8 Eric W. Biederman 2007-02-20 365 return err; bc56bba8 Eric W. Biederman 2007-02-20 366 } bc56bba8 Eric W. Biederman 2007-02-20 367 d823e3e7 Adrian Bunk 2007-10-16 368 static struct mempolicy *shm_get_policy(struct vm_area_struct *vma, d823e3e7 Adrian Bunk 2007-10-16 369 unsigned long addr) bc56bba8 Eric W. Biederman 2007-02-20 370 { bc56bba8 Eric W. Biederman 2007-02-20 371 struct file *file = vma->vm_file; bc56bba8 Eric W. Biederman 2007-02-20 372 struct shm_file_data *sfd = shm_file_data(file); bc56bba8 Eric W. Biederman 2007-02-20 373 struct mempolicy *pol = NULL; bc56bba8 Eric W. Biederman 2007-02-20 374 bc56bba8 Eric W. Biederman 2007-02-20 375 if (sfd->vm_ops->get_policy) bc56bba8 Eric W. Biederman 2007-02-20 376 pol = sfd->vm_ops->get_policy(vma, addr); 52cd3b07 Lee Schermerhorn 2008-04-28 377 else if (vma->vm_policy) bc56bba8 Eric W. Biederman 2007-02-20 378 pol = vma->vm_policy; 52cd3b07 Lee Schermerhorn 2008-04-28 379 bc56bba8 Eric W. Biederman 2007-02-20 380 return pol; bc56bba8 Eric W. Biederman 2007-02-20 381 } bc56bba8 Eric W. Biederman 2007-02-20 382 #endif bc56bba8 Eric W. Biederman 2007-02-20 383 239521f3 Manfred Spraul 2014-01-27 384 static int shm_mmap(struct file *file, struct vm_area_struct *vma) ^1da177e Linus Torvalds 2005-04-16 385 { bc56bba8 Eric W. Biederman 2007-02-20 386 struct shm_file_data *sfd = shm_file_data(file); b0e15190 David Howells 2006-01-06 387 int ret; b0e15190 David Howells 2006-01-06 388 bc56bba8 Eric W. Biederman 2007-02-20 389 ret = sfd->file->f_op->mmap(sfd->file, vma); bc56bba8 Eric W. Biederman 2007-02-20 390 if (ret != 0) bc56bba8 Eric W. Biederman 2007-02-20 391 return ret; bc56bba8 Eric W. Biederman 2007-02-20 392 sfd->vm_ops = vma->vm_ops; 2e92a3ba David Howells 2007-07-31 393 #ifdef CONFIG_MMU 54cb8821 Nick Piggin 2007-07-19 394 BUG_ON(!sfd->vm_ops->fault); 2e92a3ba David Howells 2007-07-31 395 #endif bc56bba8 Eric W. Biederman 2007-02-20 396 vma->vm_ops = &shm_vm_ops; bc56bba8 Eric W. Biederman 2007-02-20 397 shm_open(vma); b0e15190 David Howells 2006-01-06 398 b0e15190 David Howells 2006-01-06 399 return ret; ^1da177e Linus Torvalds 2005-04-16 400 } ^1da177e Linus Torvalds 2005-04-16 401 4e982311 Kirill Korotaev 2006-10-02 402 static int shm_release(struct inode *ino, struct file *file) 4e982311 Kirill Korotaev 2006-10-02 403 { bc56bba8 Eric W. Biederman 2007-02-20 404 struct shm_file_data *sfd = shm_file_data(file); 4e982311 Kirill Korotaev 2006-10-02 405 bc56bba8 Eric W. Biederman 2007-02-20 406 put_ipc_ns(sfd->ns); bc56bba8 Eric W. Biederman 2007-02-20 407 shm_file_data(file) = NULL; bc56bba8 Eric W. Biederman 2007-02-20 408 kfree(sfd); 4e982311 Kirill Korotaev 2006-10-02 409 return 0; 4e982311 Kirill Korotaev 2006-10-02 410 } 4e982311 Kirill Korotaev 2006-10-02 411 02c24a82 Josef Bacik 2011-07-16 412 static int shm_fsync(struct file *file, loff_t start, loff_t end, int datasync) 516dffdc Adam Litke 2007-03-01 413 { 516dffdc Adam Litke 2007-03-01 414 struct shm_file_data *sfd = shm_file_data(file); 516dffdc Adam Litke 2007-03-01 415 7ea80859 Christoph Hellwig 2010-05-26 416 if (!sfd->file->f_op->fsync) 7ea80859 Christoph Hellwig 2010-05-26 417 return -EINVAL; 02c24a82 Josef Bacik 2011-07-16 418 return sfd->file->f_op->fsync(sfd->file, start, end, datasync); 516dffdc Adam Litke 2007-03-01 419 } 516dffdc Adam Litke 2007-03-01 420 7d8a4569 Will Deacon 2012-06-07 421 static long shm_fallocate(struct file *file, int mode, loff_t offset, 7d8a4569 Will Deacon 2012-06-07 422 loff_t len) 7d8a4569 Will Deacon 2012-06-07 423 { 7d8a4569 Will Deacon 2012-06-07 424 struct shm_file_data *sfd = shm_file_data(file); 7d8a4569 Will Deacon 2012-06-07 425 7d8a4569 Will Deacon 2012-06-07 426 if (!sfd->file->f_op->fallocate) 7d8a4569 Will Deacon 2012-06-07 427 return -EOPNOTSUPP; 7d8a4569 Will Deacon 2012-06-07 428 return sfd->file->f_op->fallocate(file, mode, offset, len); 7d8a4569 Will Deacon 2012-06-07 429 } 7d8a4569 Will Deacon 2012-06-07 430 bc56bba8 Eric W. Biederman 2007-02-20 431 static unsigned long shm_get_unmapped_area(struct file *file, bc56bba8 Eric W. Biederman 2007-02-20 432 unsigned long addr, unsigned long len, unsigned long pgoff, bc56bba8 Eric W. Biederman 2007-02-20 433 unsigned long flags) bc56bba8 Eric W. Biederman 2007-02-20 434 { bc56bba8 Eric W. Biederman 2007-02-20 435 struct shm_file_data *sfd = shm_file_data(file); c4caa778 Al Viro 2009-11-30 436 return sfd->file->f_op->get_unmapped_area(sfd->file, addr, len, c4caa778 Al Viro 2009-11-30 437 pgoff, flags); bc56bba8 Eric W. Biederman 2007-02-20 438 } bc56bba8 Eric W. Biederman 2007-02-20 439 9a32144e Arjan van de Ven 2007-02-12 440 static const struct file_operations shm_file_operations = { 4e982311 Kirill Korotaev 2006-10-02 441 .mmap = shm_mmap, 516dffdc Adam Litke 2007-03-01 442 .fsync = shm_fsync, 4e982311 Kirill Korotaev 2006-10-02 443 .release = shm_release, ed5e5894 David Howells 2010-01-15 444 #ifndef CONFIG_MMU ed5e5894 David Howells 2010-01-15 445 .get_unmapped_area = shm_get_unmapped_area, ed5e5894 David Howells 2010-01-15 446 #endif 6038f373 Arnd Bergmann 2010-08-15 447 .llseek = noop_llseek, 7d8a4569 Will Deacon 2012-06-07 448 .fallocate = shm_fallocate, c4caa778 Al Viro 2009-11-30 449 }; c4caa778 Al Viro 2009-11-30 450 c4caa778 Al Viro 2009-11-30 451 static const struct file_operations shm_file_operations_huge = { c4caa778 Al Viro 2009-11-30 452 .mmap = shm_mmap, c4caa778 Al Viro 2009-11-30 453 .fsync = shm_fsync, c4caa778 Al Viro 2009-11-30 454 .release = shm_release, bc56bba8 Eric W. Biederman 2007-02-20 455 .get_unmapped_area = shm_get_unmapped_area, 6038f373 Arnd Bergmann 2010-08-15 456 .llseek = noop_llseek, 7d8a4569 Will Deacon 2012-06-07 457 .fallocate = shm_fallocate, ^1da177e Linus Torvalds 2005-04-16 458 }; ^1da177e Linus Torvalds 2005-04-16 459 c4caa778 Al Viro 2009-11-30 460 int is_file_shm_hugepages(struct file *file) c4caa778 Al Viro 2009-11-30 461 { c4caa778 Al Viro 2009-11-30 462 return file->f_op == &shm_file_operations_huge; c4caa778 Al Viro 2009-11-30 463 } c4caa778 Al Viro 2009-11-30 464 f0f37e2f Alexey Dobriyan 2009-09-27 465 static const struct vm_operations_struct shm_vm_ops = { ^1da177e Linus Torvalds 2005-04-16 466 .open = shm_open, /* callback for a new vm-area open */ ^1da177e Linus Torvalds 2005-04-16 467 .close = shm_close, /* callback for when the vm-area is released */ 54cb8821 Nick Piggin 2007-07-19 468 .fault = shm_fault, bc56bba8 Eric W. Biederman 2007-02-20 469 #if defined(CONFIG_NUMA) bc56bba8 Eric W. Biederman 2007-02-20 470 .set_policy = shm_set_policy, bc56bba8 Eric W. Biederman 2007-02-20 471 .get_policy = shm_get_policy, ^1da177e Linus Torvalds 2005-04-16 472 #endif ^1da177e Linus Torvalds 2005-04-16 473 }; ^1da177e Linus Torvalds 2005-04-16 474 f4566f04 Nadia Derbey 2007-10-18 475 /** f4566f04 Nadia Derbey 2007-10-18 476 * newseg - Create a new shared memory segment f4566f04 Nadia Derbey 2007-10-18 477 * @ns: namespace f4566f04 Nadia Derbey 2007-10-18 478 * @params: ptr to the structure that contains key, size and shmflg f4566f04 Nadia Derbey 2007-10-18 479 * d9a605e4 Davidlohr Bueso 2013-09-11 480 * Called with shm_ids.rwsem held as a writer. f4566f04 Nadia Derbey 2007-10-18 481 */ 7748dbfa Nadia Derbey 2007-10-18 482 static int newseg(struct ipc_namespace *ns, struct ipc_params *params) ^1da177e Linus Torvalds 2005-04-16 483 { 7748dbfa Nadia Derbey 2007-10-18 484 key_t key = params->key; 7748dbfa Nadia Derbey 2007-10-18 485 int shmflg = params->flg; 7748dbfa Nadia Derbey 2007-10-18 486 size_t size = params->u.size; ^1da177e Linus Torvalds 2005-04-16 487 int error; ^1da177e Linus Torvalds 2005-04-16 488 struct shmid_kernel *shp; d69f3bad Robin Holt 2013-04-30 489 size_t numpages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 239521f3 Manfred Spraul 2014-01-27 490 struct file *file; ^1da177e Linus Torvalds 2005-04-16 491 char name[13]; ^1da177e Linus Torvalds 2005-04-16 492 int id; ca16d140 KOSAKI Motohiro 2011-05-26 @493 vm_flags_t acctflag = 0; ^1da177e Linus Torvalds 2005-04-16 494 4e982311 Kirill Korotaev 2006-10-02 495 if (size < SHMMIN || size > ns->shm_ctlmax) ^1da177e Linus Torvalds 2005-04-16 496 return -EINVAL; --- 0-DAY kernel build testing backend Open Source Technology Center http://lists.01.org/mailman/listinfo/kbuild Intel Corporation _______________________________________________ kbuild mailing list kbuild@lists.01.org https://lists.01.org/mailman/listinfo/kbuild