Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752146AbbHGK1P (ORCPT ); Fri, 7 Aug 2015 06:27:15 -0400 Received: from mail-bl2on0107.outbound.protection.outlook.com ([65.55.169.107]:46152 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751898AbbHGK1K convert rfc822-to-8bit (ORCPT ); Fri, 7 Aug 2015 06:27:10 -0400 Authentication-Results: spf=pass (sender IP is 206.191.229.116) smtp.mailfrom=microsoft.com; davemloft.net; dkim=none (message not signed) header.d=none; From: Dexuan Cui To: KY Srinivasan , David Miller CC: "olaf@aepfle.de" , "gregkh@linuxfoundation.org" , "jasowang@redhat.com" , "driverdev-devel@linuxdriverproject.org" , "linux-kernel@vger.kernel.org" , "stephen@networkplumber.org" , "stefanha@redhat.com" , "netdev@vger.kernel.org" , "apw@canonical.com" , "pebolle@tiscali.nl" , "dan.carpenter@oracle.com" Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register callbacks to process hvsock connection Thread-Topic: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register callbacks to process hvsock connection Thread-Index: AQHQyk2vp4eFpUHUkUGmpaGSjS0WOJ3zwGiQgAqwL6CAAOYiAIABC0/Q Date: Fri, 7 Aug 2015 10:26:57 +0000 Message-ID: References: <1438086911-19384-1-git-send-email-decui@microsoft.com> <20150729.152651.331017965932467028.davem@davemloft.net> <115a97288d1e4c239fcbaab28298c552@SIXPR30MB031.064d.mgd.msft.net> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [141.251.57.69] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11FD018;1:d/05W4TGPlEKMye8JCHXMlhD8TKaypzT5xa4KC+wJHrUivHqftmsaT7fJxqX8kqSv3gvQw+vWm3QjkdTgbv7TSWRVoOGXPVYrDvNOAWXFAPWJRRgy3yG/XqTNpkMz02GOpT+zlUnjkLWVMEYq6UcNPtNCI5dI/X8QklKnOFLWIx3NVMEjBVbs29xk1PmsMqhO4JYBCtC5K3jrxPzkBnIeduqng3TYOxvf4pe6Q8CGNdji3kruhcVF4CjI8tVB+QlEPHrSGXR13xHNgNFu/YOOrBFRRWDrY7knG9sorfW6KsquWtyqW7CxzgeETj8PMV3 X-Forefront-Antispam-Report: CIP:206.191.229.116;CTRY:US;IPV:CAL;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(2980300002)(438002)(35754003)(189002)(13464003)(377454003)(164054003)(199003)(2656002)(50466002)(5001960100002)(5003600100002)(97756001)(97736004)(10090500001)(5001860100001)(4001540100001)(189998001)(5001830100001)(86612001)(5001770100001)(46102003)(10290500002)(10400500002)(86362001)(92566002)(23726002)(106466001)(81156007)(2561002)(5005710100001)(69596002)(50986999)(33646002)(2950100001)(46406003)(102836002)(2421001)(19580405001)(6806004)(68736005)(16796002)(62966003)(2900100001)(87936001)(24736003)(108616004)(77156002)(106116001)(1511001)(19580395003)(93886004)(26826002)(54356999)(64706001)(66066001)(86146001)(76176999)(47776003);DIR:OUT;SFP:1102;SCL:1;SRVR:CY1PR0301MB1260;H:064-smtp-out.microsoft.com;FPR:;SPF:Pass;PTR:ErrorRetry;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1260;2:FKdef2KcopAkoGaDQ/MMZ9BvAksjtjZYDorRHnots4EBxg5RBhPotJ7ZNH1NiSCkt928IYOnzltq+C8hqdHGGdTURI9MzfGtmtdbp4Dt0SnoJmcJQ0qdEzHZCQSSKDpBRyC34Vv+Gu5QPURcS224lIkVNd6kAq2Mt3Jr2o6o3lw=;3:Z/kWABvWVPcMfyhOU4D9yBstIarmO2IsO6TxvOthZ6JJQSYrkZeit2RR96DD0thEEg5NYiBzAxK7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ql/1l8OLmO7gL;4:mnDxQG+xTR4brD1dROKrruQ0oTc/zQ4uFO5Cx/io/HcZgX0waeGPu4JL2H1kpUDr1/gmN2hjzu5i7ZwIH4EIOIH5U64v5w1d9nuWWVOFKzNXK4uOwHtKMoBsbOcQnkK/QgJqV2MmIEtbOcqs7xBB5EGLx5ZE+Kq8PfUeEGH97UOTuhuyhsyKOsrKXRSGB47Nj9hDhnDAZ6h/3xuxUDBzFa124I4cun5cHOOekvP/83pHH/H9sfrJm350vyPGHPJdwW6OwyFPtYMp0/0OOdMBuqE0pbS6tYnHx1hSCaq9MVfXxNBOwH3w8xGzjZb0gxDQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(108003899814671); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401001)(5005006)(3002001);SRVR:CY1PR0301MB1260;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB1260; X-Forefront-PRVS: 066153096A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY1PR0301MB1260;23:wrNzboOVLr7B6EJtz1LS046k3671oH4aR5tKFaI?= =?us-ascii?Q?TVCtg8IBXa+gKdoUf6shQIFFxCV2SvEbGy2wOElpfLpcmVyzeV9HLgV19Z8T?= =?us-ascii?Q?OV5HwWGgC6HnVTBmhGc1pNHJIwHPFQ+ZpyX9hL+9+WYQX/IbivIggBeAUGEa?= =?us-ascii?Q?rOlzIwg3wRU68IRoZnaqiFePt/FYMEa14NoqmmYVToQT9o2ii35X6BuiJbv0?= =?us-ascii?Q?3NPaixn3AkTaupW4B/hWXR220kZRYQ84XVhQ318nuMtnWJv7UaVRuAAjS6fR?= =?us-ascii?Q?TZ/gbn+ts83pqTa5TKvvuG5SBeyew8qaRx8aauwLJC9RwpsZVeixLZwiz7/V?= =?us-ascii?Q?40a6jehGZ9Z6ruTUPastobZPtqkJNDcrQsFsPqPqGwjyjpEG4spow2EFgS7H?= =?us-ascii?Q?acujWdZhdJ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52?= =?us-ascii?Q?vEmR4QEQeSYkWQawXQkpQihf5kY9mXaDgz09Rg6BQzHEh50uxuG8lC2cLzjx?= =?us-ascii?Q?+XhDk1B6yGKW4JQvxIACFhaGYzLo0mB8azKo1lH8qRSXxktPCcfqCKhbrgzs?= =?us-ascii?Q?rGDn8CdxtNKKaCsirNGHQhxtvxNuLNef2jP5fz+9hcSbB+wUflbTf6N/L6UR?= =?us-ascii?Q?ZGCloecZbdP6rWygKJZC5xjbpC9mksKZ/GFimPKow2biy/qrNDXypmyrc?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB1260;5:vOQaTVuy6pdQ/IKVWrW0vDjuDUBnsIztYsj1hWY/1HGXH8AzZiB+DcgsnLBstG0scELVawV682GBudsuRW9QfuvnbzH+Vspu8KHVnUb3RY8vgQEPUgvkLF1b82+0FXD8RZHWFqUAVP/ChmjZBr60GA==;24:lFKKVfQw6lDvdlyRq2G3z0b6zvUQv6x2unASUXAKn8+hL6OnRh4BCkc7VLXstdOYg3/l+T+5/PQ0msk5CfwoRwJdMu0L++V/mZhRYjwHVtQ=;20:dHUXM+4zQDIzDoALCYlblI3qvFVSlwAUeuuHPm5kr0DyozWzLJGaHgNsfvr5nsNDDvZMkOWDvu1ZrY74Sgr73Q== X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2015 10:27:04.5795 (UTC) X-MS-Exchange-CrossTenant-Id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=72f988bf-86f1-41af-91ab-2d7cd011db47;Ip=[206.191.229.116];Helo=[064-smtp-out.microsoft.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB1260 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5292 Lines: 130 > -----Original Message----- > From: KY Srinivasan > Sent: Friday, August 7, 2015 2:28 > To: Dexuan Cui ; David Miller > Cc: olaf@aepfle.de; gregkh@linuxfoundation.org; jasowang@redhat.com; > driverdev-devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; > stephen@networkplumber.org; stefanha@redhat.com; netdev@vger.kernel.org; > apw@canonical.com; pebolle@tiscali.nl; dan.carpenter@oracle.com > Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register callbacks to > process hvsock connection > > > -----Original Message----- > > From: Dexuan Cui > > Sent: Wednesday, August 5, 2015 9:54 PM > > To: David Miller ; KY Srinivasan > > > > Cc: olaf@aepfle.de; gregkh@linuxfoundation.org; jasowang@redhat.com; > > driverdev-devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; > > stephen@networkplumber.org; stefanha@redhat.com; > > netdev@vger.kernel.org; apw@canonical.com; pebolle@tiscali.nl; > > dan.carpenter@oracle.com > > Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register callbacks > > to process hvsock connection > > > > > From: devel [mailto:driverdev-devel-bounces@linuxdriverproject.org] On > > Behalf > > > Of Dexuan Cui > > > Sent: Thursday, July 30, 2015 18:20 > > > To: David Miller ; KY Srinivasan > > > > > Cc: olaf@aepfle.de; gregkh@linuxfoundation.org; jasowang@redhat.com; > > > driverdev-devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; > > > stephen@networkplumber.org; stefanha@redhat.com; > > netdev@vger.kernel.org; > > > apw@canonical.com; pebolle@tiscali.nl; dan.carpenter@oracle.com > > > Subject: RE: [PATCH V4 4/7] Drivers: hv: vmbus: add APIs to register > > callbacks to > > > process hvsock connection > > > > > > > From: David Miller > > > > Sent: Thursday, July 30, 2015 6:27 > > > > > > > > From: Dexuan Cui > > > > Date: Tue, 28 Jul 2015 05:35:11 -0700 > > > > > > > > > With the 2 APIs supplied by the VMBus driver, the coming net/hvsock > > driver > > > > > can register 2 callbacks and can know when a new hvsock connection is > > > > > offered by the host, and when a hvsock connection is being closed by > > the > > > > > host. > > > > > > > > > This is an extremely terrible interface. > > > > > > > > It's an opaque hook that allows on registry, and it's solve purpose > > > > is to allow a backdoor call into a foreign driver in another module. > > > > > > > > These are exactly the things we try to avoid. > > > > > > Hi David, > > > Thanks a lot for your reviewing and the suggestion! > > > > > > > Why not create a real abstraction where clients register an object, > > > > that can be contained as a sub-member inside of their own driver > > > > private, that provides the callback registry mechanism. > > > > Hi David, > > Can you please have a look at my below questions? > > > > I like your idea of a real abstraction. Your answer would definitely > > help me to implement that correctly. > > > > > Please pardon me for my inexperience. > > > Can you please be a bit more specific? > > > I guess maybe you're referencing a common design pattern in the driver > > > code, so an example in some existing driver would be the best. :-) > > > > > > "clients register an object " -- > > > does the "clients" mean the hvsock driver? > > > and the "object" means the 2 callbacks? > > > > > > IMHO, here the vmbus driver has to synchronously pass the 2 events > > > to the hvsock driver, so a "backdoor call into the hvsock driver" is > > > inevitable anyway? > > > > > > e.g., in the path vmbus_process_offer() -> hvsock_process_offer(), the > > > return value of the latter is important to the former, because on error > > > the former needs to clean up some internal states of the vmbus driver > > (that > > > is, the "goto err_deq_chan"). > > > > > > > > > > That way you can register multiple clients, do things like allow > > > > AF_PACKET capturing of vmbus traffic, etc. > > > > > > I thought AF_PACKET can only capture IP packetsor Ethernet frames. > > > Can it be used to capture AF_UNIX packet? > > > If yes, I suppose we can consider making it work for AF_HYPERV too, > > > if people ask for that. > > > > > Dexuan, > > The notion of a channel on Hyper-V has been mapped to a device on Linux and > the mechanism we have > had of notifying the driver of the creation of the channel was through > registering this device with the kernel > (vmbus_device_create). The first exception to this was when we introduced > multi-channel support that broke > the assumption of this one to one mapping between the channel and Linux > device. In the case of the sub-channels, > we handled the driver notification issue via the sub-channel callback that the > driver registers at the point of > opening the channel. Perhaps we could make the sub-channel handling > mechanism more generic to handle the case > of VMSOCK as well? > > K. Y Good suggestion! Let me think this over and make a new patch. Thanks, -- Dexuan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/