Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2664784lqz; Wed, 3 Apr 2024 05:18:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXht/GFJZ92XN8WGz2W0HyGzg4i3o5tG8604odi2/GQUpyUyLEcJTJFlQXuhS43YhkSZ9Io5XdBy2eX3J5+PSCMbGS98XkAvxJFN0Y96w== X-Google-Smtp-Source: AGHT+IFHPWjz9KnZFT3d2Kg4It2Rd/wU1dgCxZ5dLq0UE5VVba4TmQla6XQYsQrULDhmMUrvr239 X-Received: by 2002:a50:c34d:0:b0:56e:988:e60a with SMTP id q13-20020a50c34d000000b0056e0988e60amr793239edb.41.1712146700633; Wed, 03 Apr 2024 05:18:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712146700; cv=pass; d=google.com; s=arc-20160816; b=P15rJKJ79xwxrWduvZLBI83tBT45qfGdVcICD3Im1dx5eW6Ro4rRqlETxpomS9DhqF q0G0WEMtN+MDgARYUswhLIBXUPTVErPK55Vm6n9ugGgqzS8ILfWUjnnHVHxnx5DXLxlg QsPITkb8qZBtKu83bpGf4fHn6UdsjWi39vS3mCfH7hhvsxDAgdaAilCIAGgGT467rQ4H zv0CREl/EmVXtMV7m6N4v5Fc+ITaSJBR6f9/B+tb/WiCdJLdwY9qD6xEambEbNsikTEV 5e+NbuCcaYsu8Cpxxouhb/4PbROTJqLPkO0lczjRh9C16KI6AXiEKS6K+ZLp/qVo1rVh MHTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=Au+qGYcIXnyg9fBfqDiuIqwrBJxSF6u8tnJvbmFQaMM=; fh=0F5yb7z6ohY9ruhbBDKMzf9e9LwvV5wwqOMIdcpoweU=; b=QWmGuIFKZGk1IvNWO9HyYT+4ZHT3ktzSn/rmG2T4LcqFsK4N3t4bdS/4oBTsaBiE9q QXspJWgU57PBajjG0lo69wEWVZoHUowHE7k1P2o2WyjdtItai9cl1VzXBND8KpoTDohA I8Ftt4mto2Fg6fxOcARb14NjzTQjZRVEFtGxb4Ly581fewQgwZiXLpf+wmZ0PBSitNrf RLgjfAIJjMdZxOZxy0fAws1n1O+qcFmwBYJe5l4xfbcBP01nrQ+deDTmfFbrPTEQh1d1 x2eWd4ht9rIFesJpS415QlywE+XySsySa8S5YCUqr/eulyGdJV5yTXctowDOAN3YIVAv qwyQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-129710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129710-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h11-20020a056402280b00b0056c264a3a42si6708264ede.527.2024.04.03.05.18.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:18:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-129710-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129710-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 057ED1F2118F for ; Wed, 3 Apr 2024 12:18:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E94F9146585; Wed, 3 Apr 2024 12:18:11 +0000 (UTC) Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9DEFE145FE9; Wed, 3 Apr 2024 12:18:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712146691; cv=none; b=ZZ/wp6sESSgIqdoHrfq0kb+DJeyTyQSP1wsWOPEB0PIjkXKr7Kg2bi7t/kcJNLXYdhF3tvHNZpEwMxUOtUip9DCwrm+H6R0mPXUMA6LFSEL9jJV4bskkI+s9b2Km0SbExgmaZ2axMu1IfFRWCUyUT8vyJOUIBPkQ9MCdZjarZQc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712146691; c=relaxed/simple; bh=7aQEolH/bYahKfD2MbBpmzlriV0zGZkS0AmAA/p9AoU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ImB4PxT1T1rt3dPIuUVaqyUGZCxV5/OiTwTZayiDcuxCp8zvcaVwsdK780YUM/aQ78Ok3JRjc1W7Tz50v6dxVm2fEW2Z5T4jrsm4PMZfK8GdqgfF06tkrGbPWI77AsC3w1ONKs5y6Y9IXZDDF8DQlhmcpzpHhEPf+M/fJR31P2U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.218.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-a51320fc5d6so57123366b.1; Wed, 03 Apr 2024 05:18:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712146688; x=1712751488; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Au+qGYcIXnyg9fBfqDiuIqwrBJxSF6u8tnJvbmFQaMM=; b=cCjy1j1V3ezly8HNKaCVjDstw+X2sFctkTzpt6ZNHsSaBIL8HxjNaj/flDe1JApqrf fqoZYw/wz+xyKyMASCcolqH4KKVIkN5p7TqSQyGaKKwP4wAg8xKZs9hoVmBVonphITHU rFaMSazWLrJT/NplP8J9Md0k6nqs2froLVrj5XOebhqiwHy0Ui7VR8921vwLrIscRBs4 xGQimvTbED3SUZdQqMcNvrKuAjlRgUg0NizhEmswbOGQdd8+erFkqcctzxhy4igH/s6+ 5yYFKC+HI7ie2rTV0U3IfNrqkCzjtqricgJocVyliuBRrmQnFmJI/qesj10WYFGGP54D 6DiQ== X-Forwarded-Encrypted: i=1; AJvYcCUii1mz7YB0ZcfX3nExzTmlIS1xzX9KWuMgQzjjez8SUpnMpTvJrgfzW2z8NS58QZFAGsP7X+dJ0g+dFpeKGGqk+VazmecMhYbMEDUnGjspbyvK/BmQjOm/PvHxeqAEjh7f8wz668CQGg== X-Gm-Message-State: AOJu0YwVt2xJX7nOxPfr1m2+ztaWHwKK+lmWUeW0qXxYVqlhaxQCcmMi o4uXPHiwpe2Md6E8i2pUT1L4FawGTzgewliO7WIYIedSampyFAcP X-Received: by 2002:a17:906:f6c6:b0:a46:cc87:12f3 with SMTP id jo6-20020a170906f6c600b00a46cc8712f3mr9250582ejb.75.1712146687766; Wed, 03 Apr 2024 05:18:07 -0700 (PDT) Received: from gmail.com (fwdproxy-lla-005.fbsv.net. [2a03:2880:30ff:5::face:b00c]) by smtp.gmail.com with ESMTPSA id la6-20020a170907780600b00a4e2db8ffdcsm6902621ejc.111.2024.04.03.05.18.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 05:18:07 -0700 (PDT) Date: Wed, 3 Apr 2024 05:15:10 -0700 From: Breno Leitao To: Dennis Dalessandro Cc: Jakub Kicinski , Leon Romanovsky , Jason Gunthorpe , keescook@chromium.org, "open list:HFI1 DRIVER" , open list Subject: Re: [PATCH v4] IB/hfi1: allocate dummy net_device dynamically Message-ID: References: <20240319090944.2021309-1-leitao@debian.org> <20240401115331.GB73174@unreal> <20240401075306.0ce18627@kernel.org> <2453e7d4-fd50-42ae-a322-490e7e691dc6@cornelisnetworks.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2453e7d4-fd50-42ae-a322-490e7e691dc6@cornelisnetworks.com> On Mon, Apr 01, 2024 at 11:34:23AM -0400, Dennis Dalessandro wrote: > On 4/1/24 10:53 AM, Jakub Kicinski wrote: > > On Mon, 1 Apr 2024 14:53:31 +0300 Leon Romanovsky wrote: > >> On Tue, Mar 19, 2024 at 02:09:43AM -0700, Breno Leitao wrote: > >>> Embedding net_device into structures prohibits the usage of flexible > >>> arrays in the net_device structure. For more details, see the discussion > >>> at [1]. > >>> > >>> Un-embed the net_device from struct hfi1_netdev_rx by converting it > >>> into a pointer. Then use the leverage alloc_netdev() to allocate the > >>> net_device object at hfi1_alloc_rx(). > >>> > >>> [1] https://lore.kernel.org/all/20240229225910.79e224cf@kernel.org/ > >>> > >>> Signed-off-by: Breno Leitao > >>> Acked-by: Dennis Dalessandro > >> > >> Jakub, > >> > >> I create shared branch for you, please pull it from: > >> https://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git/log/?h=remove-dummy-netdev > > > > Did you merge it in already? > > Turned out that the use of init_dummy_netdev as a setup function > > is broken, I'm not sure how Dennis tested this :( > > We should have pinged you, sorry. > > This is what I tested, Linus 6.8 tag + cherry pick + Breno patch. So if > something went in that broke it I didn't have it in my tree. > > commit 311810a6d7e37d8e7537d50e26197b7f5f02f164 (linus-master) > Author: Breno Leitao > Date: Wed Mar 13 03:33:10 2024 -0700 > > IB/hfi1: allocate dummy net_device dynamically This one has a potential bug that causes a kernel panic when the module is removed. This is because alloc_netdev() allocates some data structures that are later overwritten (memset) by init_dummy_netdev(). At the free time, free_netdev() will dereference those structures and they are zero. A new upcoming patch is creating a helper (init_dummy_netdev()) that will allocate the netdev and call a special version of init_dummy_netdev() without memsetting the structure. I would drop this patch for now, and I will submit a new version using the new helper.