From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 130E61C687 for ; Fri, 15 Mar 2024 12:18:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710505091; cv=none; b=CidXnolDvhvhYEQeih7FbHN4XcxRPfcBaj4wwF7Ne+peGx8q/SEG7/6gKUwrrLLVP3nlPsixrftqXP9Ktu8kVA/JPchb3zL22ce6Xm7kGrDpJM7t/PN1ExS4R4m9t0DGS8+OEQRz1oX87u805Da8Jxi7LSyWm4vjA2HDMYRZckA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710505091; c=relaxed/simple; bh=OXBEZqhs7kDse6BVOLPyb/0TPxks7Uu4zNmjP25UPs4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=VjZczs7uP0emNMMBgEDXVVmDmbXlRDdk0upjEnbFMITwNhBWe47jo84D5EcW3Hm+g4IQWbYfiZYoFgoiUrr/rUOsuHQSjjC2dFj7Ti+9eWHZmQExVT+WtxT1aevLZaRr4XAemjgc9PBxcJ8KUCnWCnP8U/iiS1R6XjaqaHLesuI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=O8CPO8hk; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="O8CPO8hk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710505089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=RkV+0UDwdwnEtpTzSiYVVxf6L/nYIk2GiTDZOWrLMLA=; b=O8CPO8hkFsReA0TzyII3P7kY5yAG7zq6uPdT7XywlxFaoDTb/jKmOw9OdndNlH+KlYg200 gWEWpnZOPsAXpCYu9yuLJWHpL75ehgQ6rriX7wjOP8dpgSX+QvGQ0Lpit2iFB9gJ+aCdKa 1dlxPVfrM2l1n+yqmbRpbQS4YqKliGw= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-423-2P5q7AxxOZCO0dI-vc4yOw-1; Fri, 15 Mar 2024 08:17:50 -0400 X-MC-Unique: 2P5q7AxxOZCO0dI-vc4yOw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 1E5F5185A781; Fri, 15 Mar 2024 12:17:49 +0000 (UTC) Received: from fedora (unknown [10.72.116.52]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D18562166B4F; Fri, 15 Mar 2024 12:17:35 +0000 (UTC) Date: Fri, 15 Mar 2024 20:17:31 +0800 From: Ming Lei To: Andreas Hindborg Cc: Miguel Ojeda , Jens Axboe , Keith Busch , Boqun Feng , Christoph Hellwig , Damien Le Moal , Bart Van Assche , Hannes Reinecke , "linux-block@vger.kernel.org" , Andreas Hindborg , Wedson Almeida Filho , Niklas Cassel , Greg KH , Matthew Wilcox , Miguel Ojeda , Alex Gaynor , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Alice Ryhl , Chaitanya Kulkarni , Luis Chamberlain , Yexuan Yang <1182282462@bupt.edu.cn>, Sergio =?iso-8859-1?Q?Gonz=E1lez?= Collado , Joel Granados , "Pankaj Raghav (Samsung)" , Daniel Gomez , open list , "rust-for-linux@vger.kernel.org" , "lsf-pc@lists.linux-foundation.org" , "gost.dev@samsung.com" Subject: Re: [RFC PATCH 1/5] rust: block: introduce `kernel::block::mq` module Message-ID: References: <20240313110515.70088-1-nmi@metaspace.dk> <20240313110515.70088-2-nmi@metaspace.dk> <87il1ptck0.fsf@metaspace.dk> <87plvwsjn5.fsf@metaspace.dk> <8734ssrkxd.fsf@metaspace.dk> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <8734ssrkxd.fsf@metaspace.dk> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 On Fri, Mar 15, 2024 at 08:52:46AM +0100, Andreas Hindborg wrote: > Miguel Ojeda writes: > > > On Thu, Mar 14, 2024 at 8:23 PM Andreas Hindborg wrote: > >> > >> The way the current code compiles, >> kernel::types::AlwaysRefCounted>::dec_ref` is inlined into the `rnull` > >> module. A relocation for `rust_helper_blk_mq_free_request_internal` > >> appears in `rnull_mod.ko`. I didn't test it yet, but if > >> `__blk_mq_free_request` (or the helper) is not exported, I don't think > >> this would be possible? > > > > Yeah, something needs to be exported since there is a generic > > involved, but even if you want to go the route of exporting only a > > different symbol, you would still want to put it in the C header so > > that you don't get the C missing declaration warning and so that we > > don't have to write the declaration manually in the helper. > > That is what I did: > > @@ -703,6 +703,7 @@ int blk_mq_alloc_sq_tag_set(struct blk_mq_tag_set *set, > unsigned int set_flags); > void blk_mq_free_tag_set(struct blk_mq_tag_set *set); > > +void __blk_mq_free_request(struct request *rq); > void blk_mq_free_request(struct request *rq); > int blk_rq_poll(struct request *rq, struct io_comp_batch *iob, > unsigned int poll_flags); Can you explain in detail why one block layer internal helper is called into rnull driver directly? It never happens in C driver code. Thanks, Ming