Re: Question about memcpy
I agree !,just i think the problem is still there,memcpy is indeed faster in kernel than in user,i've tried both ways . schedule might be to blame. 2018-07-09 22:04 GMT+08:00 Himanshu Jha : > Hi Bing, > > On Sun, Jul 08, 2018 at 10:03:48PM +0800, bing zhu wrote: > > void *p = malloc(4096 * max); > > start = usec(); > > for (i = 0; i < max; i++) { > > memcpy(p + i * 4096, page, 4096); > > } > > end = usec(); > > printf("%s : %d time use %lu us \n", __func__, max,end - start); > > > > static unsigned long usec(void) > > { > > struct timeval tv; > > gettimeofday(, 0); > > return (unsigned long)tv.tv_sec * 100 + tv.tv_usec; > > } > > I think for these benchmarking stuff, to evaluate the cycles and time > correctly you should use the __rdtscp(more info at "AMD64 Architecture > Programmer’s Manual Volume 3: General-Purpose and System Instructions" > Pg 401) > > Userspace: > -- > #include > #include > #include > #include > > volatile unsigned sink; > unsigned int junk; > > int main (void) > { > clock_t start = clock(); > register uint64_t t=__rdtscp(); > > for(size_t i=0; i<1000; ++i) > sink++; > > t=__rdtscp()-t; > clock_t end = clock(); > double cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC; > > printf("for loop took %f seconds to execute %zu cylces\n", cpu_time_used, > t); > } > - > > Kernelspace: > If you want to dig more: > https://www.intel.com/content/dam/www/public/us/en/ > documents/white-papers/ia-32-ia-64-benchmark-code-execution-paper.pdf > > > Thanks > -- > Himanshu Jha > Undergraduate Student > Department of Electronics & Communication > Guru Tegh Bahadur Institute of Technology > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: [PATCH] vsprintf: fix build warning
On Tue, 10 Jul 2018 09:42:03 +1000, "Tobin C. Harding" said: > I was under the impression that each maintainer constantly rebased their > next branches and that was why one has to checkout the tagged linux-next > each day instead of just pulling. Close, but no cigar. The maintainers don't rebase their -next branches, but due to the way linux-next merges 200+ trees on top of current Linus tree, *that* ends up rebasing every day. pgpMgaIICxzey.pgp Description: PGP signature ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: [PATCH] vsprintf: fix build warning
On Tue, 10 Jul 2018 09:42:03 +1000 "Tobin C. Harding" wrote: > Steve if you do not rebase your next branch and the branch ends up > containing fixes to patches like the above doesn't this mean that when > you do a pull request to Linus the branch you are asking to be pulled > will be too 'dirty' i.e. I thought that the pull request should be like > a patch set and only contain the 'final product' not every change that > was made during development? Nope, once I push to next, my branch is ready to be worked against. Sha1 and all. Rebasing will break that. I also have a full test suite that all my code runs through and it must pass before sending to Linus or linux-next. > > I was under the impression that each maintainer constantly rebased their > next branches and that was why one has to checkout the tagged linux-next Some maintainers (Ingo being one) is very against any unnecessary rebasing. This is because it can hide the history and development of code. Linus doesn't like to see rebasing of public trees. Once you rebase, you lose all the prior testing done on the previous code. It also makes it difficult for anyone that is basing code off of it. > each day instead of just pulling. From information on the net somewhere > I have been checking out linux-next using this shell function > > checkout-next () { > local branch='linux-next' > > git checkout master > git remote update linux-next > git branch -D $branch > git checkout -b $branch $(git tag -l "next-*" | tail -1) > } I believe linux-next itself creates its master branch each time it pulls in everyone's branches. It throws away the old one, and pulls in all the new ones. This makes sense because otherwise the history will be loaded with pulls from various branches. And yes, some branches will rebase. If just one branch rebases, then it would need to do this. > > Also, when my leaks tree got included in linux-next I was told that it > was ok to rebase and have since been rebasing mercilessly. It's really a choice for the maintainer. I consider a branch that goes into next as "tested". I wont rebase unless there is a nasty bug that I don't want to go upstream. Or a compiler failure. Warnings don't bother me. I've sometimes rebased to add Acked-by/Reviewed-by tags. But that's because the code is identical to what was there before (I do git diffs to confirm that). Linus has yelled at people that have rebased just before sending a pull request to him. -- Steve ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Question about watchdog
On 07/09/2018 12:17 PM, valdis.kletni...@vt.edu wrote: > Linux doesn't have a "filesystem bus". of course not. i mispoke -- So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www.brooklyn-living.com Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: [PATCH] vsprintf: fix build warning
CC'ing kernel newbies for anyone else trying to learn how linux-next works. On Fri, Jul 06, 2018 at 11:49:51AM -0400, Steven Rostedt wrote: > On Fri, 6 Jul 2018 23:42:13 +0900 > Sergey Senozhatsky wrote: > > > On (07/06/18 15:47), Arnd Bergmann wrote: > > [..] > > > Fixes: bfe80ed3d7c7 ("vsprintf: add command line option > > > debug_boot_weak_hash") > > > > Seems like this one is still in linux-next. > > Can we squash this patch and bfe80ed3d7c7? > > > > I prefer not to do squashes unless absolutely necessary. Yes, it is in > next, but even branches pulled into next should try to resist rebasing > (I never rebase my next branch unless there is a real bug that will > break bisecting). Steve if you do not rebase your next branch and the branch ends up containing fixes to patches like the above doesn't this mean that when you do a pull request to Linus the branch you are asking to be pulled will be too 'dirty' i.e. I thought that the pull request should be like a patch set and only contain the 'final product' not every change that was made during development? I was under the impression that each maintainer constantly rebased their next branches and that was why one has to checkout the tagged linux-next each day instead of just pulling. From information on the net somewhere I have been checking out linux-next using this shell function checkout-next () { local branch='linux-next' git checkout master git remote update linux-next git branch -D $branch git checkout -b $branch $(git tag -l "next-*" | tail -1) } Also, when my leaks tree got included in linux-next I was told that it was ok to rebase and have since been rebasing mercilessly. thanks in advance for your time, Tobin. ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Regarding Signing Linux kernel with Microsoft secure boot keys for UEFI
Hi All Thx for your answers ... Great learning... I will reread them and understand better slowly and thoroughly. On Sun 8 Jul, 2018, 11:20 PM , wrote: > On Sun, 08 Jul 2018 11:21:08 +0530, inventsekar said: > > > I read this page few times but I am unable to understand what's Linus's > > idea..Why he disagree ... > > whether the Linux kernel should include code that makes it easier to boot > > Linux on Windows PCs. > > The issue is "trusted boot", and it doesn't actually make it easier to > boot Linux. > > The problem is that the obvious way to implement it for a distro requires > an > intermediate key signed by Microsoft. > > In other words, you can't do it easily without Microsoft's permission. > Although > pretty much all UEFI boxes that support secure boot allow installing > trusted > private keys, it's not something you can do in the middle of an Ubuntu > install - > it requires dropping down into the BIOS screens and setting a bunch of > stuff. > > So the only way to do it in a distro-friendly manner without involving > Microsoft is to have the Linux Foundation or similar non-distro entity > create a > public/private key pair, and somebody gets *all* the vendors to include > that > key as well as Mirosoft's key. Dell, Lenovo, Toshiba, And all the others. > Because any vendor that doesn't include it will get reports on the web > "Trusted > boot of Linux on Zen-Cheap doesn't work." > > Which, of course, most hardware manufacturers don't give a rat's tail > about, > because if they did, they'd fix their buggy BIOS that create pages on the > web > "suspend doesn't work on Zen-Cheap". > > (In actual practice, what happened was that somebody got Microsoft to sign > an intermediate UEFI blob that allows bootstrapping a Linux kernel, and > distros > have included that blob. However, just like linux-firmware is packaged > separately > from the kernel due to the differing license on most firmware (which isn't > GPL), > that blob has to be distributed separate from the kernel as well. > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Question about watchdog
On Mon, 09 Jul 2018 09:30:51 -0400, Ruben Safir said: > On 07/08/2018 04:44 PM, valdis.kletni...@vt.edu wrote: > > Error while parsing statement., What is a "filesystem bus" and when does it > > issue a HW interrupt? > You have a hard drive on the system bus and it sends interupts... That's probably on the PCI or USB buses - Linux doesn't have a "filesystem bus". pgpg0v7cVqune.pgp Description: PGP signature ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Question about memcpy
On Mon, 09 Jul 2018 19:34:44 +0530, Himanshu Jha said: > I think for these benchmarking stuff, to evaluate the cycles and time > correctly you should use the __rdtscp(more info at "AMD64 Architecture > Programmerâs Manual Volume 3: General-Purpose and System Instructions" > Pg 401) Just beware that many Intel (and maybe some AMD) chipsets have a non-constant TSC frequency. Check /proc/cpuinfo for 'constant_tsc' before relying on the value. pgpQ1gxUPeraD.pgp Description: PGP signature ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Question about memcpy
Hi Bing, On Sun, Jul 08, 2018 at 10:03:48PM +0800, bing zhu wrote: > void *p = malloc(4096 * max); > start = usec(); > for (i = 0; i < max; i++) { > memcpy(p + i * 4096, page, 4096); > } > end = usec(); > printf("%s : %d time use %lu us \n", __func__, max,end - start); > > static unsigned long usec(void) > { > struct timeval tv; > gettimeofday(, 0); > return (unsigned long)tv.tv_sec * 100 + tv.tv_usec; > } I think for these benchmarking stuff, to evaluate the cycles and time correctly you should use the __rdtscp(more info at "AMD64 Architecture Programmer’s Manual Volume 3: General-Purpose and System Instructions" Pg 401) Userspace: -- #include #include #include #include volatile unsigned sink; unsigned int junk; int main (void) { clock_t start = clock(); register uint64_t t=__rdtscp(); for(size_t i=0; i<1000; ++i) sink++; t=__rdtscp()-t; clock_t end = clock(); double cpu_time_used = ((double) (end - start)) / CLOCKS_PER_SEC; printf("for loop took %f seconds to execute %zu cylces\n", cpu_time_used, t); } - Kernelspace: If you want to dig more: https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/ia-32-ia-64-benchmark-code-execution-paper.pdf Thanks -- Himanshu Jha Undergraduate Student Department of Electronics & Communication Guru Tegh Bahadur Institute of Technology ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Question about watchdog
On 07/08/2018 04:44 PM, valdis.kletni...@vt.edu wrote: > Error while parsing statement., What is a "filesystem bus" and when does it > issue a HW interrupt? You have a hard drive on the system bus and it sends interupts... Not to mention other devices like network cards, GPUs, Firewire, express PCI and PLP, and even the CPU and LUNA All these hard peices demand attention and send interupts on the system bus http://www.nylxs.com/docs/journal_2_2015.pdf -- So many immigrant groups have swept through our town that Brooklyn, like Atlantis, reaches mythological proportions in the mind of the world - RI Safir 1998 http://www.mrbrklyn.com DRM is THEFT - We are the STAKEHOLDERS - RI Safir 2002 http://www.nylxs.com - Leadership Development in Free Software http://www.brooklyn-living.com Being so tracked is for FARM ANIMALS and and extermination camps, but incompatible with living as a free human being. -RI Safir 2013 ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Re: Question about memcpy
in kernel you should use this func: static unsigned long usec(void) { struct timeval tv; do_gettimeofday(); return (unsigned long)tv.tv_sec * 100 + tv.tv_usec; } 2018-07-09 15:54 GMT+08:00 袁建鹏 : > can you show all code kernel and userspace ? > > Kernel compile options are optimized, very different from userspace. > > you can use the same object (memcpy.o) to link userspace program and > kernel module. > > -原始邮件- > *发件人:*"bing zhu" > *发送时间:*2018-07-08 22:03:48 (星期日) > *收件人:* "Valdis Kletnieks" > *抄送:* kernelnewbies@kernelnewbies.org > *主题:* Re: Question about memcpy > > void *p = malloc(4096 * max); > start = usec(); > for (i = 0; i < max; i++) { > memcpy(p + i * 4096, page, 4096); > } > end = usec(); > printf("%s : %d time use %lu us \n", __func__, max,end - start); > > static unsigned long usec(void) > { > struct timeval tv; > gettimeofday(, 0); > return (unsigned long)tv.tv_sec * 100 + tv.tv_usec; > } > > > I'm don't think it's really precise but i did notice a difference , > > 2018-07-08 2:44 GMT+08:00 : > >> On Sat, 07 Jul 2018 19:36:47 +0800, bing zhu said: >> >> > and in user space i do the same thing,I noticed that kernel is faster >> than >> > user , >> >> How did you measure the times? Doing this right is actually harder than >> it looks... >> > > ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
Re: Re: Question about memcpy
can you show all code kernel and userspace ? Kernel compile options are optimized, very different from userspace. you can use the same object (memcpy.o) to link userspace program and kernel module. -原始邮件- 发件人:"bing zhu" 发送时间:2018-07-08 22:03:48 (星期日) 收件人: "Valdis Kletnieks" 抄送: kernelnewbies@kernelnewbies.org 主题: Re: Question about memcpy void *p = malloc(4096 * max); start = usec(); for (i = 0; i < max; i++) { memcpy(p + i * 4096, page, 4096); } end = usec(); printf("%s : %d time use %lu us \n", __func__, max,end - start); static unsigned long usec(void) { struct timeval tv; gettimeofday(, 0); return (unsigned long)tv.tv_sec * 100 + tv.tv_usec; } I'm don't think it's really precise but i did notice a difference , 2018-07-08 2:44 GMT+08:00 : On Sat, 07 Jul 2018 19:36:47 +0800, bing zhu said: > and in user space i do the same thing,I noticed that kernel is faster than > user , How did you measure the times? Doing this right is actually harder than it looks... ___ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies