Bug #3720
Tunables needs volatile keyword
0%
Description
Here is a part of the source code with three tunables:
299static uint_t nfs3_max_transfer_size_clts = 32 * 1024; 300static uint_t nfs3_max_transfer_size_cots = 1024 * 1024; 301static uint_t nfs3_max_transfer_size_rdma = 1024 * 1024; 302 303uint_t 304nfs3_tsize(struct knetconfig *knp) 305{ 306 307 if (knp->knc_semantics == NC_TPI_COTS_ORD || 308 knp->knc_semantics == NC_TPI_COTS) 309 return (nfs3_max_transfer_size_cots); 310 if (knp->knc_semantics == NC_TPI_RDMA) 311 return (nfs3_max_transfer_size_rdma); 312 return (nfs3_max_transfer_size_clts); 313}
And here is how the nfs3_tsize function is compiled in (in OpenIndiana) :
> nfs3_tsize::dis nfs3_tsize: pushq %rbp nfs3_tsize+1: movq %rsp,%rbp nfs3_tsize+4: subq $0x8,%rsp nfs3_tsize+8: movq %rdi,-0x8(%rbp) nfs3_tsize+0xc: movl (%rdi),%eax nfs3_tsize+0xe: leal -0x2(%rax),%ecx nfs3_tsize+0x11: cmpl $0x1,%ecx nfs3_tsize+0x14: jbe +0x12 <nfs3_tsize+0x28> nfs3_tsize+0x16: cmpl $0x5,%eax nfs3_tsize+0x19: movl $0x100000,%eax nfs3_tsize+0x1e: movl $0x8000,%ecx nfs3_tsize+0x23: cmovl.ne %ecx,%eax nfs3_tsize+0x26: jmp +0x5 <nfs3_tsize+0x2d> nfs3_tsize+0x28: movl $0x100000,%eax nfs3_tsize+0x2d: leave nfs3_tsize+0x2e: ret >
It means that the compiler treats all three tunables above as constants (and they are not changed in the nfs_common.c file). This is not what we want.
The reason for it is that tunables are missing the volatile keyword. In addition, because of bug #3718 in Sun CC, we are required to remove the static keyword from all tunables.
This bug aims to add the volatile keyword (and remove the static keyword) from all tunables documented in SOLTUNEPARAMREF (https://github.com/rmustacc/illumos-docbooks/tree/master/stage/docs/SOLTUNEPARAMREF)
Related issues
Updated by Rich Lowe about 8 years ago
- Subject changed from Tunables needs volatile keyword to nfs tunables should not be static
Don't add 'volatile', remove 'static'. Static tunables are inherently non-sensical. You want them to be globally visible -- so you can tune them!
Updated by Marcel Telka about 8 years ago
- Subject changed from nfs tunables should not be static to Tunables needs volatile keyword
This bug is about all documented tunables, not NFS only. But I must admit that NFS tunables are the primary driver for the change.