Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp197193imj; Thu, 14 Feb 2019 18:28:39 -0800 (PST) X-Google-Smtp-Source: AHgI3IYjoGJrR1xg32tOYpTgxeLs7rECGeUdrzxPN99F1ByBd/nIoRZPCA8y0rkgo1KbPHc1Uwtr X-Received: by 2002:a65:6683:: with SMTP id b3mr3038473pgw.423.1550197719504; Thu, 14 Feb 2019 18:28:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550197719; cv=none; d=google.com; s=arc-20160816; b=ugI0zh005RB32zoLmmh9f2qr0KUO/dcYo1KmeckjVQQP/Am430UJYeBmaEY3RtYvKt 2CuzEVWXhS5a8GYK1hKI8f772GiubMMgf/8h5Vfd/Og7SF5bVZUNckNBWslrBtVdN1ML Do8FhalIxWVj3tQYqAbFcF8TOITpgFCc7fKTDCYBz9IUVB+5znQAT7ntwl7Qf7tH8M7F ArT6W6CUoRrs4yEYGEVfyIyEBWKLWOD2H20nxDiqD6tUzLte3cM+H0mWbtYkaB+6Jz+W NqWLaaEHFW5B7TttY/3euK7rBDQHT05iSj/FcSwk8lnlBo1fOaTYxHQk1HA97oA+C/za 065w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=BD1z/5AEQ7Po6biyHnFbC0e+ud+fPZG79wkQpCGGuiY=; b=TiFHu25MV5bc8Wq54fbvZufG/wbL55b8agIv2o2ZXFdu0Cra5NhbTq9As1QnT6/OUO PTPO9TiQFcMh5RjTYapVfJ3fxWqzEQ2BJaPkvp5E/9NrA49Uy6y8AqED0mtP3HJ5IoES yB2t4cfeAexR2PsNaiyMKei4ueffnlxvjXsWwLS3m8m5/k3T41hJDJ7a8kvR47IiptEn N39yd/+pbQml2iIgXOpUcK39SULBNTCVxCh/LEskiPFwrOxGMuGvcDt1+KxRxUYlOeYY X0WdW+gkiQ8eVgdB7lnUGY44vRKHQMftiwYteBdur7NcDiPRY4+0m2xTbCjp4aS31C4d LbPw== 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 l2si4074466pgn.521.2019.02.14.18.28.23; Thu, 14 Feb 2019 18:28:39 -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 S1730600AbfBOBAs (ORCPT + 99 others); Thu, 14 Feb 2019 20:00:48 -0500 Received: from nautica.notk.org ([91.121.71.147]:58980 "EHLO nautica.notk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729172AbfBOBAr (ORCPT ); Thu, 14 Feb 2019 20:00:47 -0500 Received: by nautica.notk.org (Postfix, from userid 1001) id 90B5BC009; Fri, 15 Feb 2019 02:00:44 +0100 (CET) Date: Fri, 15 Feb 2019 02:00:29 +0100 From: Dominique Martinet To: David Miller Cc: doronrk@fb.com, tom@quantonium.net, davejwatson@fb.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] kcm: remove any offset before parsing messages Message-ID: <20190215010029.GA10899@nautica> References: <1536657703-27577-1-git-send-email-asmadeus@codewreck.org> <20180912053642.GA2912@nautica> <20180917.184502.447385458615284933.davem@davemloft.net> <20180918015723.GA26300@nautica> <20181031025657.GA17861@nautica> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20181031025657.GA17861@nautica> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dominique Martinet wrote on Wed, Oct 31, 2018: > Anyway, that probably explains I have no problem with bigger VM > (uselessly more memory available) or without KASAN (I guess there's > overhead?), but I'm sending at most 300k of data and the VM has a 1.5GB > of ram, so if there's an allocation failure there I think there's a > problem ! . . . > > So, well, I'm not sure on the way forward. Adding a bpf helper and > document that kcm users should mind the offset? bump on this - I had mostly forgotten about it but the nfs-ganesha community that could make use of KCM reminded me of my patch that's waiting for this. Summary for people coming back after four months: - kcm is great, but the bpf function that's supposed to be called for each packet does not automatically adjust the offset so that it can assume the skb starts with the packet it needs to look at - there is some workaround code that is far from obvious and undocumented, see the original thread[1]: [1] http://lkml.kernel.org/r/20180822183852.jnwlxnz54gbbf6po@davejwatson-mba.dhcp.thefacebook.com - my patch here tried to automatically pull the corresponding packet to the front, but apparently with KASAN can trigger out of memory behaviours on "small" VMs, so even if it doesn't seem to impact performance much without KASAN I don't think it's really ok to potentially hang the connection due to oom under severe conditions. The best alternative I see is adding a proper helper to get "kcm_rx_msg(skb)->offset" from bpf and document it so users aren't as lost as I have been; I'm not quite sure how/where to add such a helper though as I've barely looked at the bpf code until now, but should we go for that? (it really feels wrong to me that some random person who just started by trying to use kcm has to put this much effort to keep the ball rolling, if nobody cares about kcm I'm also open to have it removed completely despite the obvious performance gain I benchmarked for ganesha[2] ; barely maintained feature is worse than no feature) [2] https://review.gerrithub.io/c/ffilz/nfs-ganesha/+/421314 Thanks, -- Dominique