-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add(function): modify find_first_bit function to support building on … #292
add(function): modify find_first_bit function to support building on … #292
Conversation
…arm64 Related to: openebs/openebs#1295 Modify the find_first_bit function in istgt_lu_disk.c, which is implemented by using asm and cannot run on arm64. And add the implementation by using c language. Signed-off-by: wangzihao <[email protected]>
Hi @Wangzihao18 I think few more changes are required to build istgt for ARM architecture..
Details of the system used for compilation :
|
Hi, @mynktl .Yes, thanks for your tips. Some changes can be seen in this commit wangzihao3@166463b. Because the modifications are little too much. I am not sure the changes are all right, So I split them up. I will continue update the other changes |
Ok @Wangzihao18 . Thanks for the information! |
src/istgt_lu_disk.c
Outdated
res_final +=res; | ||
if((unsigned long)res != nbits) | ||
res_final += res; | ||
if ((unsigned long)res != nbits) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we fix it for this case also as you did for aarch64? Can we put a check if ((unsigned long)res != nbits << 6)
here also.
res += 64; | ||
} | ||
} | ||
res_final += res; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets have these 3 lines common for both the case and put it out of #ifdef.
src/istgt_lu_disk.c
Outdated
res += __builtin_ffsl(addr[idx]) - 1; | ||
break; | ||
} else { | ||
res += 64; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use sizeof (addr[0]) or sizeof (*addr) instead of constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, thanks @pawanpraka1 . These changes are great. I will update them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One question is, the value of sizeof(*addr) is 8, but we should plus 64 here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should I use sizeof(*addr) * 8
or other methods ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good point. sizeof returns bytes, we should convert that to bits here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can do sizeof(*addr) << 3 and put some comments saying we need bits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will update it now ^^
src/istgt_lu_disk.c
Outdated
return res_final; | ||
#elif defined(__aarch64__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also there is no aarch64 specific code here. Lets put this in #else section so that it works for all other architecture.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes , I am working on these codes.
ifdef. Signed-off-by: wangzihao <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good.
@Wangzihao18 |
Sure @mynktl . I am working on it now. I can build it successfully, but I don't know how to test it. I will raise the PR now. |
Ok @Wangzihao18 . We will test it in our lab. |
…arm64
Related to: openebs/openebs#1295
Modify the find_first_bit function in istgt_lu_disk.c, which is
implemented by using asm and cannot run on arm64. And add the
implementation by using c language.
Signed-off-by: wangzihao [email protected]