lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b135b474-b167-67ad-588c-b0cfe8dc2998@intel.com>
Date:   Fri, 19 Mar 2021 13:31:34 +0800
From:   Jie Deng <jie.deng@...el.com>
To:     Viresh Kumar <viresh.kumar@...aro.org>,
        Arnd Bergmann <arnd@...db.de>
Cc:     "Enrico Weigelt, metux IT consult" <lkml@...ux.net>,
        Linux I2C <linux-i2c@...r.kernel.org>,
        virtualization@...ts.linux-foundation.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "Michael S. Tsirkin" <mst@...hat.com>,
        Wolfram Sang <wsa@...nel.org>,
        Jason Wang <jasowang@...hat.com>,
        Wolfram Sang <wsa+renesas@...g-engineering.com>,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        conghui.chen@...el.com, kblaiech@...lanox.com,
        jarkko.nikula@...ux.intel.com,
        Sergey Semin <Sergey.Semin@...kalelectronics.ru>,
        Mike Rapoport <rppt@...nel.org>, loic.poulain@...aro.org,
        Tali Perry <tali.perry1@...il.com>,
        Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
        Bjorn Andersson <bjorn.andersson@...aro.org>,
        yu1.wang@...el.com, shuo.a.liu@...el.com,
        Stefan Hajnoczi <stefanha@...hat.com>,
        Paolo Bonzini <pbonzini@...hat.com>
Subject: Re: [PATCH v8] i2c: virtio: add a virtio i2c frontend driver


On 2021/3/19 11:54, Viresh Kumar wrote:
> On 18-03-21, 15:52, Arnd Bergmann wrote:
>> Allowing multiple virtio-i2c controllers in one system, and multiple i2c
>> devices attached to each controller is clearly something that has to work.
> Good.
>
>> I don't actually see a limitation though. Viresh, what is the problem
>> you see for having multiple controllers?
> I thought this would be a problem in that case as we are using the global
> virtio_adapter here.
>
> +       vi->adap = &virtio_adapter;
> +       i2c_set_adapdata(vi->adap, vi);
>
> Multiple calls to probe() will end up updating the same pointer inside adap.
>
> +       vi->adap->dev.parent = &vdev->dev;
>
> Same here, overwrite.
>
> +       /* Setup ACPI node for controlled devices which will be probed through ACPI */
> +       ACPI_COMPANION_SET(&vi->adap->dev, ACPI_COMPANION(pdev));
> +       vi->adap->timeout = HZ / 10;
>
> These may be fine, but still not ideal I believe.
>
> +       ret = i2c_add_adapter(vi->adap);
> i
> This should be a problem as well, we must be adding this to some sort of list,
> doing some RPM stuff, etc ?
>
> Jie, the solution is to allocate memory for adap at runtime in probe and remove
> the virtio_adapter structure completely.


If you want to support that. Then I think we don't need to change the 
following at all.

> +    .algo = &virtio_algorithm,
> +
> +        return ret;
> +
> +    vi->adap = virtio_adapter;
This is strange, why are you allocating memory for adapter twice ?
Once for virtio_adapter and once for vi->adap ? Either fill the fields
directly for v->adap here and remove virtio_adapter or make vi->adap a
pointer.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ