Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1371479imu; Wed, 9 Jan 2019 17:19:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN7ujZoI8j4uBYwMw5wysRYA4zBbzQCM5ZdjI72IA27IhlV8z4mkQMnqhpOvKy5Alp3aSExp X-Received: by 2002:a17:902:5066:: with SMTP id f35mr8370446plh.78.1547083148941; Wed, 09 Jan 2019 17:19:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547083148; cv=none; d=google.com; s=arc-20160816; b=LYqvEcv9qvAJajBGvDnLdldGIZmBTZAlbhv28RD7ZeFhlPv5nLQyqxqib7fzdm+won /P78c+5LQOXFL9ObG0sdcEsHTFLuNgjjWPIEmxPijD7/HPEzGclDXcn46LG5txOTfzH2 hjHKcUsS6xcrrDtNlssb5Sf71q8x6Yg61eqKmMfzbrMRUpwzmiWF/p3Rboo1ISVR+6FT B4f4m9wUy5eoTbuoln0Z8rRJrRF20OjDI7ezGWkP81jk1AboFqLl7HmzKY+2Uze8s1ed g7BWw54dUVxVuWb0doDYGwvPqKujdsI/rXYIMUxu1yr3tsm/zVb2OFPHIvKfBjPFAj9C Llpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:subject:cc:to:from:message-id:date; bh=fi8DoCS3DvP34Q5+/Ao1s/2Ru9j2BiW9YuyHfNhso0Q=; b=1JINocX3ivfMUKKfe8pv0HQExH7eNr3y4Vgbw+l2+Gz4UCfeIt4JLQGXQSG3z4kCpH jT+bhlPbuRKkxgrGvQp96d3pYXewG0zU9+VRFtMXoTzdusfi7biY/bLYpL7+SHtEg0pG npVfkbs0RuYZVS+WF0DXEN5GKy+HKqWRWRhpUqCxgi7RFXdqpkVjMmdtP2tpXH1BUQFg Mppr9zJ1leMmxE7heRlh3YvIk4Yc9z/i+ms8PZdczDcJY1olY0Ces7ojDP9pzHwMnTt+ nrlnZE2sGuqBaXctgNXFLBWXh7wzL9lB52JA/AadmWpy/B9zLEMCgrBI/jIwhN8wm3PU W2kA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j6si13534353pfc.57.2019.01.09.17.18.53; Wed, 09 Jan 2019 17:19:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727161AbfAJBQF (ORCPT + 99 others); Wed, 9 Jan 2019 20:16:05 -0500 Received: from relmlor1.renesas.com ([210.160.252.171]:18818 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726458AbfAJBQF (ORCPT ); Wed, 9 Jan 2019 20:16:05 -0500 Date: 10 Jan 2019 10:16:03 +0900 X-IronPort-AV: E=Sophos;i="5.56,459,1539615600"; d="scan'208";a="4801258" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 10 Jan 2019 10:16:03 +0900 Received: from morimoto-PC.renesas.com (unknown [10.166.18.140]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 10A794136351; Thu, 10 Jan 2019 10:16:03 +0900 (JST) Message-ID: <875zuxb9uy.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Mark Brown Cc: Jon Hunter , Liam Girdwood , linux-tegra@vger.kernel.org, Matthias Reichl , alsa-devel@alsa-project.org, Marcel Ziswiler , Takashi Iwai , linux-kernel@vger.kernel.org, Marcel Ziswiler Subject: Re: [alsa-devel] [PATCH v1 3/3] ASoC: soc-core: fix platform name vs. of_node assignement In-Reply-To: <20190109141439.GE10405@sirena.org.uk> References: <20181218174040.k7u26vnnoplllnwb@camel2.lan> <952471da-b355-6471-6c19-5120d6704f81@nvidia.com> <87lg3vuc7p.wl-kuninori.morimoto.gx@renesas.com> <865d2a3e-bf6b-1f30-1179-7e922c0d0641@nvidia.com> <87k1je38w7.wl-kuninori.morimoto.gx@renesas.com> <0660a471-3698-2059-4494-ad146518a4ed@nvidia.com> <20190109125340.GD10405@sirena.org.uk> <52f5f2cf-9260-f9c5-f73d-3c3d5debc86b@nvidia.com> <20190109141439.GE10405@sirena.org.uk> User-Agent: Wanderlust/2.15.9 Emacs/24.5 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mark, Jon > No. Offline you had suggested using kmalloc and not devm_kzalloc and so > I was worried in that case about a memory leak. Right now I am only > concerned about an invalid pointer that is not being handled correctly. I'm sorry I was confused/misunderstood, kmalloc idea was wrong. > I would like someone to explain what multi-platform means? Even if a > soundcard supports multiple platforms, there is only one platform you > are using at any time so ... (snip) > ... I don't understand why you would ever need a 'num_platform' as the > machine driver just needs to understand which platform is using it at > any given time. Right? As Mark explained, "platform" on ALSA SoC means "DMA", and we might have multiple DMA sound sysytem (= multi-platform) in the future. Currently, all driver/sysytem is using single DMA for 1 sound card. > > # So, I guess if your driver can switch to use > > # snd_soc_init_platform style directly, your problem can gone ? > > Yes that is an alternative and I can convert all the Tegra machine > drivers to use this now. However, that will not solve the problem for > non-Tegra devices and everyone will have to do this. Yeah I agree. But my concern is that the same problem happen on codec side too, by same logic, because snd_soc_init_multicodec() is overwriting dai_link too. Your posted patch solved platform side only, I think. > > >> Yes that is an alternative and I can convert all the Tegra machine > > >> drivers to use this now. However, that will not solve the problem for > > >> non-Tegra devices and everyone will have to do this. > > > > We're going to have to go through another round of conversions that > > > touch everything at some point no matter what :/ > > > Do you have a preference here? Do you think that we can fix-up the > > soc-core or should I go ahead and migrate the Tegra machine driver to > > workaround this issue now? > > We're going to need to migrate Tegra regardless so it'd be good to do > that whatever happens, I'm intending to try to properly review the patch > today. As I mentioned above, I think we have same issue on codec side too. exchanging *platform to platform doesn't solve all issues. And we need to exchange all driver again if we had multi-platform support in the future (I don't know when it can happen though...) My posted quick-patch can solve "dirty pointer" issue, but it can't solve "memory leak" issue. This issue will be solved if all driver can switch to modern style, but it needs more time. Are these correct ? So, how about this ? I will try to add snd_soc_dai_link_component support for CPU, and switch all driver to use modern style for v5.1 (or v5.2 ?). Until then, as temporary solution, we can use above quick-patch style. And to avoid "memory leak crash" attach, it temporary have bind dai_link limitation (max 5time?). If it goes to max limitation, ALSA SoC doesn't allow to try again. In such case, all related CPU/Codec driver need to rmmod/unbind, and insmod/bind again. Then, the limitation will be 0 cleared. You can try bind again. It can solve "dirty pointer" issue, "memory leak" issue, and "memory leak attack" issue. The problem is that code can be dirty temporary. But it will be removed if all driver can be swtich to modern style. Best regards --- Kuninori Morimoto