Project

General

Profile

Actions

Bug #403

closed

Different declarations of _raw_spin_lock in tests-envgen--test-twomains

Added by Vadim Mutilin almost 14 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
High
Category:
Rules and Models
Start date:
08/27/2010
Due date:
% Done:

0%

Estimated time:
Detected in build:
144ed1cd44098ea33f3b27128652989f832f3ecf
Platform:
Published in build:
f2e6786

Description

Small test tests-envgen--test-twomains.tar.bz2 fails with Error: Declaration of _raw_spin_unlock does not match previous declaration from include/linux/spinlock.h:150 (different structs(number of fields)).

In preprocessed files for _raw_spin_unlock function in model we have parameter type raw_spinlock_t, but in driver code we have type spinlock_t

The bug occurs for model=39_1

BLAST output:
/home/mutilin/temp/ldv-tools-test/test-envmodels/launcher-working-dir/ldv-manager-work-dir/work/current--X--tests-envgen--test-twomains.tar.bz2--X--regression-testmykernel-1-2.6.32.15--X--39_1/mykernel-1-2.6.32.15/csd_deg_dscv/0/dscv_tempdir/dscv/ri/39_1/kernel-rules/files/model0039.c:70: Error: Declaration of _raw_spin_unlock does not match previous declaration from include/linux/spinlock.h:150 (different structs(number of fields)).
error in collectFunction _raw_spin_unlock: Errormsg.Errorold type = TFun(TInt(int, ),
lock: TPtr(TNamed(spinlock_t,
TCompLoop(struct __anonstruct_spinlock_t_41, _, ),
), ), )
new type = TFun(TInt(int, ),
lock: TPtr(TNamed(raw_spinlock_t,
TCompLoop(struct raw_spinlock, _, ), ), ), )


Related issues 1 (0 open1 closed)

Related to Linux Driver Verification - Bug #515: Middle regression test fails!ClosedAlexandr Strakh11/01/2010

Actions
Actions #1

Updated by Vadim Mutilin almost 14 years ago

The same message appeares for the other envgen tests with single main (for example test-fops-check-stateful) but BLAST continues work after the Error and returns verdicts.

/home/mutilin/temp/ldv-tools-test/test-envmodels/launcher-working-dir/ldv-manager-work-dir/work/current--X--tests-envgen--test-fops-check-stateful.tar.bz2--X--defaultmykernel-1-2.6.32.15--X--39_1/mykernel-1-2.6.32.15/csd_deg_dscv/0/dscv_tempdir/dscv/ri/39_1/kernel-rules/files/model0039.c:65: Error: Declaration of _raw_spin_lock does not match previous declaration from include/linux/spinlock.h:147 (different structs(number of fields)).
error in collectFunction _raw_spin_lock: Errormsg.Errorold type = TFun(TVoid(),
lock: TPtr(TNamed(spinlock_t,
TCompLoop(struct __anonstruct_spinlock_t_41, _, ),
), ), )
new type = TFun(TVoid(),
lock: TPtr(TNamed(raw_spinlock_t,
TCompLoop(struct raw_spinlock, _, ), ), ), )
/home/mutilin/temp/ldv-tools-test/test-envmodels/launcher-working-dir/ldv-manager-work-dir/work/current--X--tests-envgen--test-fops-check-stateful.tar.bz2--X--defaultmykernel-1-2.6.32.15--X--39_1/mykernel-1-2.6.32.15/csd_deg_dscv/0/dscv_tempdir/dscv/ri/39_1/kernel-rules/files/model0039.c:70: Error: Declaration of _raw_spin_unlock does not match previous declaration from include/linux/spinlock.h:150 (different structs(number of fields)).
error in collectFunction _raw_spin_unlock: Errormsg.Errorold type = TFun(TInt(int, ),
lock: TPtr(TNamed(spinlock_t,
TCompLoop(struct __anonstruct_spinlock_t_41, _, ),
), ), )
new type = TFun(TInt(int, ),
lock: TPtr(TNamed(raw_spinlock_t,
TCompLoop(struct raw_spinlock, _, ), ), ), )

Actions #2

Updated by Evgeny Novikov over 13 years ago

  • Category set to Rules and Models
  • Status changed from New to Open
  • Priority changed from Normal to High

This bug causes problems with rather new kernels. Such problems must be eliminated.

Actions #3

Updated by Evgeny Novikov over 13 years ago

  • Assignee set to Evgeny Novikov

Before the rather old linux kernel of 2.6.33.1 version spin lock/unlock functionality was a macros to extern functions and all works good:

include/linux/spinlock.h
  ...
  #define spin_lock(lock) _spin_lock(lock)
  ...
kernel/spinlock.c
  ...  
  void __lockfunc _spin_lock(spinlock_t *lock)
  {
    __spin_lock(lock);
  }
  ...

Then almost all lock/unlock API became unconditional static inline functions like this:

include/linux/spinlock.h
  ...
  static inline void spin_lock(spinlock_t *lock)
  {
    raw_spin_lock(&lock->rlock);
  }
  ...

As we know without aspectator we can't add model functions directly for spin_lock and other static inline functions. The raw_spin_lock is just a macro:

include/linux/spinlock.h
  ...
  #define raw_spin_lock(lock) _raw_spin_lock(lock)
  ...

to the extern function _raw_spin_lock:
include/linux/spinlock_api_smp.h
  ...
  void __lockfunc _raw_spin_lock(raw_spinlock_t *lock) __acquires(lock);
  ...

So to make model working both with the "old" and "new" kernels both the _spin_lock and _raw_spin_lock functions were implemented in it:
model0039.c
  ... 
  void _spin_lock(spinlock_t *lock) {
    ldv_spin_lock(lock);
  }
  ...
  void _raw_spin_lock(raw_spinlock_t *lock) 
  {
    ldv_raw_spin_lock(lock);
  }
  ...

"New" kernels are processed well since there is no function _spin_lock at all while "old" kernels have the function _raw_spin_lock with another signature:
include/linux/spinlock.h
  ...
  extern void _raw_spin_lock(spinlock_t *lock);

So model and "old" kernels contain different declarations of the function _raw_spin_lock that leads to fail during parsing.

Note that these internal prototypes and types depend on configuration in the tricky way and somebody of course may try to define such configuration that allows to use model both with "old" and "new" kernels. But this is a very complex task and it doesn't give the solution in general because we still won't be able to use model in case when there is no appropriate configuration.

So we assume another obvious solution. We have to make kernel depended models! If the problem just in dependence on the kernel version ("old" kernels have some API while "new" kernels have another API that may be not backward compatible) then we must to define our kernel "API" in depend on the processed kernel version.

Actions #4

Updated by Evgeny Novikov over 13 years ago

The another solution (thanks to Alexey) is try to see on defined things. For example make dependency on spin_lock macro definition.

Actions #5

Updated by Evgeny Novikov over 13 years ago

  • Status changed from Open to Resolved
  • Published in build set to f2e6786

The problem was fixed by means of adding '#ifdef' of spin_lock.
After fix three 'Parsing errors' from small regression test set (related with this problem in 39_1 model) becomes two unsafes and one safe.
So after all there is no more problems in small regression test set! Middle test may contain changes now, we'll them tomorrow.

Actions #6

Updated by Evgeny Novikov over 13 years ago

  • Status changed from Resolved to Closed

Verified, so close it.

Actions

Also available in: Atom PDF