Project

General

Profile

Bug #3720

Tunables needs volatile keyword

Added by Marcel Telka over 7 years ago. Updated over 7 years ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
kernel
Start date:
2013-04-16
Due date:
% Done:

0%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

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

Related to illumos gate - Bug #3725: Tunables shouldn't be used in MIN()/MAX()/nz() macrosIn Progress2013-04-18

Actions
Related to illumos gate - Bug #3723: NFS client can establish more TCP connections than clnt_max_connsIn Progress2013-04-17

Actions
Has duplicate illumos gate - Feature #1141: allow NFSv3 server FSINFO tunables to be tunedClosed2011-06-23

Actions

History

#1

Updated by Rich Lowe over 7 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!

#2

Updated by Marcel Telka over 7 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.

Also available in: Atom PDF