tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: increase softint_bytes



Hi, all.

On 2017/11/17 15:35, Masanobu SAITOH wrote:
Hi, mrg.

On 2017/11/17 5:05, matthew green wrote:
Masanobu SAITOH writes:
   Hi, all.

   Some device drivers now allocate a lot of softints.
See:

    http://mail-index.netbsd.org/current-users/2017/11/09/msg032581.html

To avoid this panic, I wrote the following patch:

    http://www.netbsd.org/~msaitoh/softint-20171116-0.dif

Summary:

    - Increase the default size from 8192 bytes to 32768 bytes.
    - Add new option SOFTINT_BYTES to change the value.
    - Add two new read-only sysctls kern.softint.{max,count}

Any comment?

can't this be fixed by making it dynamic?

  It's not easy because the return value of softint_establish() is
made from this area's address. As you know, the value is keep by each driver.

 I'm sorry. I misread kern_softint.c. The return value is not directly point to
the area, but it's offset of the area, so it would be easy to resize it.

 I'll try to modify the code to do auto-resize.





 ie, fix it properly so
that it never has this problem again -- if in 10 years we're adding
5x as many softints as today, we'll hit it again.

i also don't see why the crash can't be fixed to become an error.

The code is:
ip_init(void)
{
        const struct protosw *pr;

        in_init();
        sysctl_net_inet_ip_setup(NULL);

        pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW);
        KASSERT(pr != NULL);

        ip_pktq = pktq_create(IFQ_MAXLEN, ipintr, NULL);
        KASSERT(ip_pktq != NULL); <========== This.




the code tries to avoid adding more than it can, but soemthing must
be wrong for the crash to occur anyway.

  I think this KASSERT() is reasonable.

  ie, at worst we'd fix it
to return an error instead of crashing.

if that is done, the sysctl exports seem unneccesary as well.

bridge, agr, strip, sl, stf, ppp, l2tp, gre and maybe some other
pseudo interfaces which is created by ifconfig command allocate
softint. Some of them may be created tens, hundreds or more.
So I think it's worth to check the current number.



thanks.


.mrg.





--
-----------------------------------------------
                SAITOH Masanobu (msaitoh%execsw.org@localhost
                                 msaitoh%netbsd.org@localhost)



Home | Main Index | Thread Index | Old Index