Al, As the original author of that algorithm, I would disagree. :-)
The IPMI spec does allow MCs to have gaps or variations in the SEL record ordering, however, in practice, most BMCs order the records sequentially when adding them. Creating gaps by deleting individual records is possible/allowed, but is extremely bad practice for an admin who cares about having an accurate history. In any case, the side-effect in those cases of having a few less than N records shown is trivial compared with the reason for creating this algorithm in the first place: to quickly view the last N records in the SEL when there may be a lengthy log that would take much longer to traverse. Andy -----Original Message----- From: Al Chu [mailto:ch...@llnl.gov] Sent: Friday, June 12, 2009 2:29 PM To: ipmitool-devel@lists.sourceforge.net Subject: [Ipmitool-devel] invalid assumption on sel list last Hey everyone, Someone recently gave me a feature request for FreeIPMI for the equivalent of the "sel list last N" in ipmitool. Wondering how ipmitool was able to perform this so much faster than FreeIPMI, I looked at the code and saw this in __ipmi_sel_savelist_entries(). ---- /* Get first record. */ next_id = ipmi_sel_get_std_entry(intf, 0, &evt); delta = next_id - evt.record_id; /* Get last record. */ next_id = ipmi_sel_get_std_entry(intf, 0xffff, &evt); next_id = evt.record_id + count * delta + delta; --- So, get the first record. Determine the difference between that record and the next one. Using that difference, use it to calculate what the nth to last record_id is. Then later on, use that for listing the last N elements. I don't believe this is a valid assumption. As far as I can tell, a motherboard can store records in any record id pattern it wishes. Add in the fact that a user can delete arbitrary records, and you have a problem. Here's a test on a motherboard I just tried out. # ipmitool -H pwoprjr1 -U admin1 -P poseidon sel list | wc -l 160 # ipmitool -H pwoprjr1 -U admin1 -P poseidon sel list last 50 | wc -l 33 So definitely a bug. IMO, the actual fix is to loop through all the records until you are N - count away from the end. If you don't want to do this, perhaps at a minimum it should be documented that this is not guaranteed to work. Al -- Albert Chu ch...@llnl.gov Computer Scientist High Performance Systems Division Lawrence Livermore National Laboratory ------------------------------------------------------------------------ ------ Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment. http://p.sf.net/sfu/businessobjects _______________________________________________ Ipmitool-devel mailing list Ipmitool-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipmitool-devel ------------------------------------------------------------------------------ Are you an open source citizen? Join us for the Open Source Bridge conference! Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250. Need another reason to go? 24-hour hacker lounge. Register today! http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org _______________________________________________ Ipmitool-devel mailing list Ipmitool-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ipmitool-devel