spinlock lockup suspected reasons
What could be reasons for the following message: BUG: spinlock lockup suspected on CPU#0, sh/11786 lock: kmap_lock+0x0/0x40, .magic: dead4ead, .owner: sh/11787, .owner_cpu: 1 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: kernel stack memory
Enable this CONFIG_CC_STACKPROTECTOR and you will get crash. Stack overflow does'nt necessarily creates kernel panic ;) On Thu, Sep 13, 2012 at 5:00 PM, Denis Kirjanov wrote: > At the moment of forking a new process do_fork() creates a new stack for the > task by using alloc_thread_info_node(): > > struct page *page = alloc_pages_node(node, THREADINFO_GFP, > THREAD_SIZE_ORDER); > > > On 9/13/12, Rajat Sharma wrote: >> "The kernel stack is part of task_struct of the running process" >> >> Please double check that, its not part of task_struct, rather on some >> architectures, kernel stack is extended by a thread_info structure at >> the end which keeps a link to task_struct of the process. >> >> -Rajat >> >> On Thu, Sep 13, 2012 at 1:59 PM, Arun KS wrote: >>> Hello Shubham, >>> >>> On Thu, Sep 13, 2012 at 12:15 PM, shubham sharma >>> wrote: Hi, As far as i know, the size of stack allocated in the kernel space is 8Kb for each process. But in case i use more than 8Kb of memory from the stack then what will happen? I think that in that case the system would crash because i am accessing an illegal memory area. I wrote kernel module in which i defined an integer array whose size was 8000. But still it did not crash my system. Why? The module i wrote was as follows: #include #include int __init init_my_module(void) { int arr[8000]; printk("%s:%d\tmodule initilized\n", __func__, __LINE__); arr[1] = 1; arr[4000] = 1; arr[7999] = 1; >>> >>> Instead do a memset. >>> memset(arr, 0, 8192); >>> >>> If you do this the current calling process thread_info will be set to >>> zero. >>> This should cause a crash. >>> >>> Thanks, >>> Arun >>> >>> printk("%s:%d\tarr[1]:%d, arr[4000]:%d, arr[7999]:%d\n", __func__, __LINE__, arr[1], arr[4000], arr[7999]); return 0; } void __exit cleanup_my_module(void) { printk("exiting\n"); return; } module_init(init_my_module); module_exit(cleanup_my_module); MODULE_LICENSE("GPL"); ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >>> >>> >>> >>> ___ >>> Kernelnewbies mailing list >>> Kernelnewbies@kernelnewbies.org >>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >>> >> >> ___ >> Kernelnewbies mailing list >> Kernelnewbies@kernelnewbies.org >> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >> > > > -- > Regards, > Denis > > ___ > Kernelnewbies mailing list > Kernelnewbies@kernelnewbies.org > http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Creating sparse file on XFS and EXT3 has different results
Dear Mani, -> It depends upon the actual disk block size not the file system block size .. I think that it always depends on the file-system block size. A disk block size will always less than or equal to File system block size. For example, say a FS X has block size 2K and disk block size =512. So, when you create a 1 byte file, file_size = 1byte and disk blocks =4. Now, if another FS Y has block size 4K and you create a 1 byte file then :- file_size = 1 byte and disk blocks= 8. On Mon, Aug 8, 2011 at 12:46 PM, mani wrote: > The ls uses st_size while du uses st_blocks. > So > st_size "file size in bytes" > st_blocks "number of 512 byte blocks allocated". > It depends upon the actual disk block size not the file system block size > .. > try using the ls -ls it will give you both the o/p's . > > Are you using the same hard disk with same disk block size ? > > > On Sat, Aug 6, 2011 at 9:51 PM, mani wrote: > >> Dear Ashish, >> >> The ls uses st_size while du uses st_blocks. >> try using the ls -ls it will give you both the o/p's . >> >> Thanks >> Manish >> >> On Fri, Aug 5, 2011 at 7:45 AM, Ashish Sangwan >> wrote: >> >>> I write 1 program to create sparse file which contains alternate empty >>> blocks and data blocks. For example block1=empty, block2=data, block3=empty >>> . >>> >>> #define BLOCK_SIZE 4096 >>> void *buf; >>> int main(int argc, char **argv) >>> { >>> buf=malloc(512); >>> memset(buf,"a",512); >>> int fd=0; >>> int i; >>> int sector_per_block=BLOCK_SIZE/512; >>> int block_count=4; >>> if(argc !=2 ){ >>> printf("Wrong usage\n USAGE: program absolute_path_to_write\n"); >>> _exit(-1); >>> } >>> fd=open(argv[1],O_RDWR | O_CREAT,0666); >>> if(fd <= 0){ >>> printf("file open failed\n"); >>> _exit(0); >>> } >>> while(block_count > 0){ >>> lseek(fd,BLOCK_SIZE,SEEK_CUR); >>> block_count--; >>> for(i=0;i>> write(fd,buf,512); >>> block_count--; >>> } >>> close(fd); >>> return 0; >>> } >>> >>> Suppose, I create a new_sparse_file using this above code. >>> >>> When I run this program, on ext3 FS with block size 4KB, ls -lh shows >>> size of new_sparse_file as 16KB, while du -h shows 8 kb, which, I think is >>> correct. >>> >>> On xfs, block size of 4kb, ls -lh shows 16KB but du -h shows 12kb. >>> Why are there different kinds of behavior? >>> >>> If I increase the block_count to be written so that a 200MB file is >>> created, on XFS du -h shows 187MB and on EXT3 it shows 101MB. >>> >>> ___ >>> Kernelnewbies mailing list >>> Kernelnewbies@kernelnewbies.org >>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies >>> >>> >> > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Creating sparse file on XFS and EXT3 has different results
Hole Punch. That was nice one Greg!!! I would rather try fallocate. On Fri, Aug 5, 2011 at 9:14 PM, Greg Freemyer wrote: > Apologies for the top post. I simply forgot to not do that. > > On Aug 5, 2011 8:11 AM, "Greg Freemyer" wrote: > > > > There are no "specs" as to how a sparse file is handled in response to > writes. > > > > Sparse is mostly beneficial when the holes are very large. > > > > If an app really wants to have minimal on disk space, you should > pre-allocate space with fallocate. > > > > You may even need to hole punch after the writes. Both xfs and ext4 > support both fallocate and hole punching. (I don't know the userspace call > to hole punch. I think its a relatively new feature for ext4.) > > > > Greg > > > > On Aug 4, 2011 10:16 PM, "Ashish Sangwan" > wrote: > > Greg > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Creating sparse file on XFS and EXT3 has different results
I write 1 program to create sparse file which contains alternate empty blocks and data blocks. For example block1=empty, block2=data, block3=empty . #define BLOCK_SIZE 4096 void *buf; int main(int argc, char **argv) { buf=malloc(512); memset(buf,"a",512); int fd=0; int i; int sector_per_block=BLOCK_SIZE/512; int block_count=4; if(argc !=2 ){ printf("Wrong usage\n USAGE: program absolute_path_to_write\n"); _exit(-1); } fd=open(argv[1],O_RDWR | O_CREAT,0666); if(fd <= 0){ printf("file open failed\n"); _exit(0); } while(block_count > 0){ lseek(fd,BLOCK_SIZE,SEEK_CUR); block_count--; for(i=0;i___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies