|
From: smiley g. <smi...@ya...> - 2004-07-23 07:57:19
|
Have filed a bug with a testcase. http://bugs.kde.org/show_bug.cgi?id=85756 Thanks, Madhan. --- smiley glitter <smi...@ya...> wrote: > I have proceeded a little more... > > My application is trying to run the following code, > written as assembly in a multiprocessor environment. > > This function is passed an address (data address) > and > old_value and new_value. it compares is the data in > the address is equal to the old value. if true it > puts > the newvalue in place and returns true. returns > false > otherwise. > > --------------------- > .text > .align 16 > .globl swapit > .type swapit,@function > swapit: > movl 4(%esp),%ecx /* ecx = data address > */ > movl 8(%esp),%eax /* eax = old_value */ > movl 12(%esp),%edx /* edx = new_value */ > lock; cmpxchgl %edx,(%ecx) /* Atomic > compare > and swap */ > setz %al > movzbl %al,%eax /* put ZF into %eax */ > ret /* return */ > .size swapit,.-swapit > > ---------------------- > when I enable --trace-codegen=11111 > then in the first stage I see the LOCK > > > (2) 0x8048428: movl 12(%esp,,),%edx > (2) > (2) 10: GETL %ESP, t14 > (2) 11: LEA1L 12(t14), t12 > (2) 12: LDL (t12), t16 > (2) 13: PUTL t16, %EDX > (2) 14: INCEIPo $4 > (2) > (2) 0x804842C: cmpxchgl %edx,(%ecx) > (2) > -->(2) 15: LOCKo > (2) 16: GETL %ECX, t26 > (2) 17: LDL (t26), t22 > (2) 18: GETL %EDX, t20 > (2) 19: GETL %EAX, t18 > (2) 20: MOVL t18, t24 > (2) 21: SUBL t22, t24 > (-wOSZACP) > (2) 22: CMOVLz t20, t22 > (-rOSZACP) > (2) 23: CMOVLnz t22, t18 > (-rOSZACP) > ---------------------- > At the last stage - instrumented code I donot see > the > LOCK > > (2) 12: LDL (t12), t16 > (2) 13: PUTL t16, %EDX > (2) 14: INCEIPo $4 > (2) 15: CCALLo 0xB72A4BB1(t4) > (2) 16: LDL (t4), t22 > (2) 17: MOVL t10, t24 > (2) 18: SUBL t22, t24 (-wOSZACP) > (2) 19: CMOVLz t16, t22 (-rOSZACP) > (2) 20: CMOVLnz t22, t10 (-rOSZACP) > ------------------- > > From the addrcheck code too I see that > > switch (u_in->opcode) { > case NOP: case LOCK: case CALLM_E: case > CALLM_S: > break; > > > these calls are just ignored. > > Can you please clarify if my above code will get > executed rightly when run in a smp kernel. > > In the documentation I read that the thread model > uses > only one cpu at a time. in any case there seems to > be > no atomicity guaranteed in case of lock instruction. > > Thanks, > Madhan > > --- Nicholas Nethercote <nj...@ca...> wrote: > > On Thu, 15 Jul 2004, smiley glitter wrote: > > > > > It finally turned out that the reason was not > the > > > upgrade to update 2. > > > > > > Its because of an smp kernel. > > > > > > my application hangs when run on smp kernel > > > 2.4.21-15.ELsmp, but not on 2.4.21-15.EL. > > > > I don't have any useful suggestions, but you might > > like to file a bug > > report so this isn't forgotten. > > > > N > > > > > > > __________________________________ > Do you Yahoo!? > Vote for the stars of Yahoo!'s next ad campaign! > http://advision.webevents.yahoo.com/yahoo/votelifeengine/ > > __________________________________ Do you Yahoo!? Vote for the stars of Yahoo!'s next ad campaign! http://advision.webevents.yahoo.com/yahoo/votelifeengine/ |